The website has been migrated to Docusaurus v2. ✨
:signeroption has been added to the
derivation_endpointplugin, for when you want to use custom URL signing. This is useful when using
:expires_in, and wanting to have expiring URLs work with CDN caching.
require "aws-sdk-cloudfront" signer = Aws::CloudFront::UrlSigner.new(key_pair_id: "...", private_key: "...") plugin :derivation_endpoint, expires_in: 90, signer: -> (url, expires_in:) do signer.signed_url(url, expires: Time.now.to_i + expires_in) end
The S3 storage now supports
:max_multipart_partsoption for specifying the maximum number of concurrent parts in which a large file will get uploaded. This number defaults to
Shrine::Storage::S3.new(max_multipart_parts: 1000, ...)
:encodingoption can now be passed to
S3#open, which is applied to downloaded chunks.
io = uploaded_file.open(encoding: Encoding::UTF_8) csv = CSV.new(io) # ...
Passing a boolean value to the
#remove_attachment=setter now works on Ruby 3.2. Previously this would raise an error, because Shrine would try to call
=~on it, but
Object#=~method has been removed in Ruby 3.2.
When duplicating a model instance, the duplicated attacher now references the duplicated model instance instead of the original one.
The download endpoint now returns a
400 Bad Requestresponse when the serialized file component is invalid.
derivativesplugin now supports passing
mutex: falseoption to disable usage of a mutex. This makes the
Shrine::Attacherobject marshallable, which should enable using
Marshal.loadon model instances with attachments. This should be safe unless you're adding derivatives on the same attacher object concurrently.
When loading the
versions_compatibility: true, this setting doesn't leak to other uploaders anymore. Previously if other uploaders would load
derivativesplugin without this option, versions compatibility would still get enabled for them. This change also fixes behavior on JRuby.
When S3 storage copies files, the AWS tag are not inherited anymore. This allows passing the
:taggingupload option when promoting from temporary to permanent storage, and have it take effect.
UploadedFile#urlmethod doesn't call the obsolete
URI.regexpmethod anymore, which should avoid warnings.
infer_extensionplugin now defines
infer_extensioninstance method (in addition to class method) on the uploader for convenience, so that it can be easily called at the uploader instance level.
class MyUploader < Shrine plugin :infer_extension def generate_location(io, metadata:, **) extension = infer_extension(metadata["mime_type"]) # ... end end