Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Shrine 3.5.0 does not support Rack 3 (undefined method `map' for #Rack::Files::Iterator) #672

Closed
vrodic opened this issue Feb 21, 2024 · 3 comments

Comments

@vrodic
Copy link

vrodic commented Feb 21, 2024

When using a Rails 7 application with Rack 3 and Shrine 3.5.0 we are getting a

NoMethodError

undefined method `map' for #<Rack::Files::Iterator:0x0000786dd78a7560 @path="/tmp/image_processing20240221-90664-78pq2t.jpg", @ranges=[0..1343], @options={:mime_type=>"image/jpeg", :size=>1344}>


shrine (3.5.0) lib/shrine/plugins/derivation_endpoint.rb:368:in `call`

This is the offending line:

headers["Content-Length"] ||= body.map(&:bytesize).inject(0, :+).to_s

I see there are already PRs to fix this:

#661
#660

@davidalejandroaguilar
Copy link

#660 and #661 fixes this.

The former fixes the underlying header capitalization change issue introduced on Rack > 2, while the latter fixes Shrine's fallback that should've guarded against this.

@tomasc
Copy link
Contributor

tomasc commented Mar 31, 2024

see #682

@janko
Copy link
Member

janko commented Apr 28, 2024

Should be fixed by #682.

@janko janko closed this as completed Apr 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants