Skip to main content

Shrine 3.7.1

New features

  • The derivation_endpoint plugin now supports adding a file extension to the derivation URL path via the :format option on UploadedFile#derivation_url. Some HTTP clients and CDNs use the URL path extension to determine the content type of the response.

    uploaded_file.derivation_url(:thumbnail, format: "jpg")
    #=> ".../thumbnail/eyJpZCI6ImZvbyIsInN.jpg?signature=..."

    The extension is included in the URL signature, so it cannot be tampered with.

  • The rack_response plugin now accepts an :etag option for setting a custom ETag header, overriding the default one Shrine generates.

    response = uploaded_file.to_rack_response(etag: "my-custom-etag")
    response[1]["ETag"] #=> "my-custom-etag"

Bug fixes

  • When initializing Shrine with the activerecord plugin, under Bootsnap 1.24.5 and Ruby 3.4.5 this would raise an error:

    ArgumentError: wrong number of arguments (given 2, expected 1; required keyword: plugin)

    The seems to be triggered by a special combination of method signatures, where keyword arguments get converted into positional arguments under Bootsnap. To work around this issue, method signatures of some plugin methods have been updated.