- The processing plugin has been added for declaratively defining processing for a specific action, and is now the idiomatic way to define processing in Shrine:
class MyUploader < Shrine plugin :processing process(:store) do |io, context| # ... end end
- The add_metadata plugin has been added for simpler extraction and addition of new metadata:
class ImageUploader < Shrine plugin :add_metadata add_metadata :exif do |io, context| MiniMagick::Image.new(io.path).exif end end
uploaded_file.metadata["exif"] # or uploaded_file.exif
UploadedFile#openmethod has been added to mimic
File.open, which opens the underlying IO only for the duration of the block:
uploaded_file.open do |io| # ... end # closes the IO
Storage::S3for specifying the filesize in bytes for when the storage should use aws-sdk's parallelized multipart upload/copy. Defaults to 15MB.
Aws-sdk's parallelized multipart S3 upload/copy is now automatically used for files larger than 15MB. Previously multipart upload was never used, while multipart copy would only be used for files larger than 5GB.
Storage::S3#downloadaws-sdk's downloading is now used, which retries on failed downloads.
:content_lengthoption is now passed to multipart S3 copy request, which avoids an additional HEAD request.
The backgrounding plugin doesn't require anymore that the model has the attachment module included. Previously it relied on the
The restore_cached_data plugin previously still downloaded the whole file, once the opened IO was closed. This has been fixed in the Down gem.
The determine_mime_type plugin now raises an error if the
filecommand is not installed or failed.
If delete_raw plugin was loaded after moving plugin, it could cause
Errno::ENOENTerrors. This is now fixed.
The direct_upload endpoint now always includes both
GET /:storage/presignroutes, and
:presignoption is now obsolete.
:validationsoptions to sequel and activerecord plugins for disabling callbacks and validations.
UploadedFile#downloadwill now use
Storage#downloadisn't implemented, which means that storage implementers don't need to implement this method anymore.
Storage#readmethod isn't used in the data_uri plugin anymore, which means storage implementers don't need to implement this method anymore.
Storage#clear!method has been made optional in the storage linter, since it was just a convention and isn't actually used by Shrine.
:phasecontext variable has been softly renamed to
:action. At the moment both variables are passed to
context, so referencing
:phasewill still continue to work normally, but in Shrine 3 accessing
:phasewill trigger a deprecation warning, and in Shrine 4 it will no longer work.