—
title: Shrine 3.3.0¶ ↑
New features¶ ↑
- 
The
:create_on_promoteoption has been added to thederivativesplugin for automatically creating derivatives after the attached cached file is promoted to permanent storage. 
rb   Shrine.plugin :derivatives, create_on_promote: true 
- 
The
:auto_extractionoption has been added to thestore_dimensionsplugin for skipping automatically extracting dimensions on upload. 
rb   Shrine.plugin :store_dimensions, auto_extraction: false 
- 
The
:skip_niloption has been added to theadd_metadataplugin for excluding metadata keys whose values are nil. 
rb   class PdfUploader < Shrine     add_metadata :pages, skip_nil: true do |io|       if is_pdf?(io)         reader = PDF::Reader.new(io)         reader.page_count       else         # If this is not a PDF, then the pages metadata will not be stored         nil       end     end   end 
- 
The
:downloadoption has been added to derivatives processors inderivativesplugin for skipping converting the source IO object into a file. This can be used to avoid a potentially expensive download/copy when the derivatives processor doesn’t need the file. 
rb   Attacher.derivatives :my_processor, download: false do |source|     source #=> Could be File, Shrine::UploadedFile, or other IO-like object     shrine_class.with_file(source) do |file|       # can force download/copy if necessary with `with_file`,     end   end 
Bug fixes¶ ↑
- 
The
upload_endpointnow handles callingShrine.upload_responsemethod from a Rails controller. - 
The
derivation_endpointplugin now applies theversionquery parameter to the derivation when creating the response. 
Other improvements¶ ↑
- 
The new
Aws:S3::EncryptionV2::Clientis now supported by the S3 storage for client-side encryption. - 
The
derivation_endpointnow reduces the possibility of timing attacks by comparing URL signatures in constant time usingRack::Utils.secure_compare. - 
The
derivativesplugin now copies non-file source IO objects to disk before passing them to the processor. This is consistent with how aShrine::UploadedFileobject is downloaded to disk. - 
The
sequelandactiverecordplugins now callAttacher#reloadwhen reloading the model, which reloads the attached files but keeps other attacher state. - 
The
derivativesplugin doesn’t download the attached file anymore if attempting to process derivatives when no derivatives processor was defined. - 
The
mirroringplugin now forwards attacher options when uploading to mirror storages. - 
The
presign_endpointplugin now handles theOPTIONSHTTP verb, which newer versions of Uppy are requesting. - 
Shrine::Storage::Memory#opennow always returns aStringIOin the file content’s original encoding, instead of the encoding set byEncoding.default_internal. This works around a bug inStringIOintroduced in Ruby 2.7.0. - 
The
remove_attachmentplugin now deletes the removed file if a new file was attached right after removal. 
Backwards compatibility¶ ↑
- 
If you were passing a non-file IO object to the derivatives processor,
Shrinewill now convert it into a file beforehand. If you're currently doing this and are converting the IO object into a file inside the processor, you can now remove the conversion code to avoid doubling the amount of disk writes. - 
When reloading a Sequel/ActiveRecord model, any attacher state other than uploaded files will now be retained after the reload. If you were relying on all the attacher state being re-initialized, you'll need to update your code.