Don't re-encode the file parameter in the viewer - #21718
Merged
Merged
Conversation
`parseQueryString`, i.e. `URLSearchParams`, has already percent-decoded the parameter, hence re-encoding it with `encodeURIComponent` and only restoring the slashes leaves e.g. "?", "&" and "%" escaped. This breaks relative URLs with a query string, e.g. `?file=%2Fget.jsp%3Fid%3D1%26x%3D2`, and relative URLs with a percent-encoded path. The value is now used as-is, except for a "#" in a relative URL which is still escaped: since the viewer takes its own hash parameters from the *viewer* URL, a "#" in the `file` parameter is assumed to be part of the filename (see mozilla#19990). It fixes mozilla#20137.
calixteman
temporarily deployed
to
code-coverage
August 5, 2026 19:42 — with
GitHub Actions
Inactive
calixteman
temporarily deployed
to
code-coverage
August 5, 2026 19:42 — with
GitHub Actions
Inactive
calixteman
temporarily deployed
to
code-coverage
August 5, 2026 19:42 — with
GitHub Actions
Inactive
calixteman
temporarily deployed
to
code-coverage
August 5, 2026 19:42 — with
GitHub Actions
Inactive
calixteman
temporarily deployed
to
code-coverage
August 5, 2026 19:42 — with
GitHub Actions
Inactive
calixteman
temporarily deployed
to
code-coverage
August 5, 2026 19:42 — with
GitHub Actions
Inactive
calixteman
temporarily deployed
to
code-coverage
August 5, 2026 19:42 — with
GitHub Actions
Inactive
calixteman
temporarily deployed
to
code-coverage
August 5, 2026 19:42 — with
GitHub Actions
Inactive
calixteman
temporarily deployed
to
code-coverage
August 5, 2026 19:42 — with
GitHub Actions
Inactive
calixteman
temporarily deployed
to
code-coverage
August 5, 2026 19:42 — with
GitHub Actions
Inactive
calixteman
temporarily deployed
to
code-coverage
August 5, 2026 19:42 — with
GitHub Actions
Inactive
calixteman
temporarily deployed
to
code-coverage
August 5, 2026 19:42 — with
GitHub Actions
Inactive
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #21718 +/- ##
==========================================
+ Coverage 90.03% 90.05% +0.01%
==========================================
Files 264 264
Lines 66894 66937 +43
==========================================
+ Hits 60229 60280 +51
+ Misses 6665 6657 -8
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Collaborator
|
Does this perhaps fix issue #20218 as well? |
Contributor
Author
Yes it does. |
timvandermeij
approved these changes
Aug 6, 2026
Collaborator
|
Thank you for fixing this and extending the test coverage! |
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.
parseQueryString, i.e.URLSearchParams, has already percent-decoded the parameter, hence re-encoding it withencodeURIComponentand only restoring the slashes leaves e.g. "?", "&" and "%" escaped. This breaks relative URLs with a query string, e.g.?file=%2Fget.jsp%3Fid%3D1%26x%3D2, and relative URLs with a percent-encoded path.The value is now used as-is, except for a "#" in a relative URL which is still escaped: since the viewer takes its own hash parameters from the viewer URL, a "#" in the
fileparameter is assumed to be part of the filename (see #19990).It fixes #20137.