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

Only apply URI.unescape monkey-patch if detected to be required #32210

Merged
merged 1 commit into from Mar 9, 2018
Merged

Only apply URI.unescape monkey-patch if detected to be required #32210

merged 1 commit into from Mar 9, 2018

Conversation

kivikakk
Copy link
Contributor

@kivikakk kivikakk commented Mar 9, 2018

See #32183. Commit message included here:

We test the failing case we're trying to patch; only if it throws an Exception do we patch.

Currently this will always throw, but upstream Ruby has patched this bug: https://git.io/vAxKB

Tested against current Ruby 2.5 (monkey-patch applied, tests pass) and nightly (monkey-patch not applied, tests pass).

We test the failing case we're trying to patch; only if it throws an
Exception do we patch.

Currently this will *always* throw, but upstream Ruby has patched this
bug: https://git.io/vAxKB

Signed-off-by: Ashe Connor <ashe@kivikakk.ee>
@rails-bot
Copy link

Thanks for the pull request, and welcome! The Rails team is excited to review your changes, and you should hear from @rafaelfranca (or someone else) soon.

If any changes to this PR are deemed necessary, please add them as extra commits. This ensures that the reviewer can see what has changed since they last reviewed the code. Due to the way GitHub handles out-of-date commits, this should also make it reasonably obvious what issues have or haven't been addressed. Large or tricky changes may require several passes of review and changes.

This repository is being automatically checked for code quality issues using Code Climate. You can see results for this analysis in the PR status below. Newly introduced issues should be fixed before a Pull Request is considered ready to review.

Please see the contribution instructions for more information.

@tenderlove tenderlove merged commit eec723f into rails:master Mar 9, 2018
@kivikakk kivikakk deleted the uri-selective-monkeypatch branch March 9, 2018 03:02
@pixeltrix
Copy link
Contributor

Looks like this broke static file serving with Rack::File because it now returns a 400 Bad Request because the path returned by unescape is US-ASCII with UTF-8 characters.

It strikes me as odd that the unescape method forces the encoding back to the original since a path is going to be US-ASCII by definition but the unescaped version will not be. It has however been this way since 1.9.2 so slightly confused why it's just a problem now (probably because we've been monkey patching forever 😞)

Unsure whether this needs to be fixed in Rails, Rack or Ruby.

yahonda added a commit to yahonda/rails that referenced this pull request Mar 21, 2018
since Ruby 2.6.0  will not raise `Encoding::CompatibilityError`
for the mixed unicode and percent escaped strings

Addresses rails#32294 and related to rails#32210
Refer https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?revision=62695&view=revision
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

Successfully merging this pull request may close these issues.

None yet

5 participants