Repository navigation
Conversation
SeanLF
force-pushed
the
fix-uploaded-file-kwargs
branch
from
July 27, 2026 17:58
1c6f55d to
fe4c8fb
Compare
Rack::Multipart::UploadedFile forwards missing methods to the wrapped tempfile, but the delegator was never flagged with ruby2_keywords. On Ruby 3.0+, where keywords are separated from a trailing Hash, the keywords are rebuilt as a positional Hash before reaching the tempfile: uploaded_file.readlines(chomp: true) # => TypeError: no implicit conversion of Hash into Integer uploaded_file.gets(chomp: true) # => TypeError: no implicit conversion of Hash into Integer Ruby 2.4 through 2.6 are unaffected, since they do not distinguish a trailing Hash from keywords, which is why this went unnoticed. Flag the delegator, matching BodyProxy#method_missing and MockResponse::Cookie#method_missing. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
SeanLF
force-pushed
the
fix-uploaded-file-kwargs
branch
from
July 27, 2026 18:00
fe4c8fb to
1f90e6d
Compare
jeremyevans
approved these changes
Jul 27, 2026
jeremyevans
left a comment
Contributor
There was a problem hiding this comment.
Looks good, thank you for the patch.
In the future, if you have a fix prepared, it's best to submit just the pull request and not file a separate GitHub issue.
Author
|
Understood, thanks. Follow-up in #2484 (draft, stacked on this one). |
ioquatix
reviewed
Jul 30, 2026
The trailing conditional means the line itself is always executed, so line coverage records a hit regardless of whether ruby2_keywords is called. The markers were suppressing nothing. Verified hit count of 1 on 2.6 (guard false, call skipped), 3.0 and 4.0. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Collaborator
|
Merged in #2499 |
This was referenced Aug 14, 2026
samuel-williams-shopify
pushed a commit
to socketry/rack
that referenced
this pull request
Aug 14, 2026
Backport the fix from rack#2482 to Rack 3.2, retaining ruby2_keywords because the stable branch supports Ruby 2.4.
samuel-williams-shopify
added a commit
that referenced
this pull request
Aug 14, 2026
Backport the fix from #2482 to Rack 3.2, retaining ruby2_keywords because the stable branch supports Ruby 2.4. Co-authored-by: Sean Floyd <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #2481.
Rack::Multipart::UploadedFile#method_missingdelegates to the wrapped tempfile but was never flagged withruby2_keywords, so keyword arguments are rebuilt as a positional Hash on Ruby 3.0+:This flags the delegator, matching
BodyProxy#method_missingandMockResponse::Cookie#method_missing.Ruby 2.4 to 2.6 are unaffected either way, since they do not distinguish a trailing Hash from keywords. The
respond_to?guard is kept becauseruby2_keywordsdoes not exist before 2.7.The added test fails without the change (
TypeError) and passes with it. Verified on Ruby 2.4.10, 2.6.10, 3.0.7 and 4.0.6.