Escape URI delimiters inside asset paths and query values - #841
Closed
OskarEichler wants to merge 3 commits into
Closed
Escape URI delimiters inside asset paths and query values#841OskarEichler wants to merge 3 commits into
OskarEichler wants to merge 3 commits into
Conversation
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.
Summary
Asset filenames containing
?,[or]and query values containing&are escaped as components, preserving existing plus, slash and percent handling.Ordinary serialized URIs remain byte-identical; only problematic component characters change. Existing raw-space proposal #689 is separate. Initial Regexp.union approach was rejected after ~55% slowdown; single character classes measured within about 2% of original on 38/20/223-character paths (seven alternating batches, 20,000 calls each). This is a microbenchmark, not an application-speed claim.
Reproduction
With
require "sprockets"; require "tmpdir":Verification
bundle exec rake test, 913 tests /4,109 assertions /zero failures/errors /four skips, Ruby 3.2.11 and 4.0.6. 504 focused external checks for this patch on each Ruby.49d9f20c00ac7d9a7ee57db058961edcccd86699, without unrelated upgrades.Compatibility and limitations
Breaking changes: no intentional change to valid supported behavior; the incorrect behavior above changes. No new dependencies or version upgrades. Older Ruby/Linux/JRuby checks are left to upstream CI, not claimed locally. No tests added/edited under the consumer repository's no-test-edit policy; focused evidence was run externally. Prepared with AI assistance. This is a focused correction, not an exhaustive Sprockets review.