Fix #20420: Prevent double decoding of file URL parameter#20482
Fix #20420: Prevent double decoding of file URL parameter#20482timvandermeij merged 1 commit intomozilla:masterfrom
Conversation
timvandermeij
left a comment
There was a problem hiding this comment.
(re-adding the "request changes" that disappeared because the comment above is not addressed yet)
There was a problem hiding this comment.
The change looks good to me, but please squash the commits into one (see https://github.com/mozilla/pdf.js/wiki/Squashing-Commits if you're not familiar with how to do that). After that we can trigger the integration tests.
42f64cb to
a254485
Compare
|
/botio integrationtest |
From: Bot.io (Linux m4)ReceivedCommand cmd_integrationtest from @timvandermeij received. Current queue size: 1 Live output at: http://54.241.84.105:8877/6685b2f5ba9465a/output.txt |
From: Bot.io (Windows)ReceivedCommand cmd_integrationtest from @timvandermeij received. Current queue size: 1 Live output at: http://54.193.163.58:8877/9a30ae3ca91a5d3/output.txt |
From: Bot.io (Linux m4)SuccessFull output at http://54.241.84.105:8877/6685b2f5ba9465a/output.txt Total script time: 20.26 mins
|
From: Bot.io (Windows)SuccessFull output at http://54.193.163.58:8877/9a30ae3ca91a5d3/output.txt Total script time: 41.55 mins
|
|
Thank you for your contribution! |
Fixes #20420
Description
This PR fixes a regression where passing a URL with encoded parameters (e.g.,
?token=%2Ffoo) to the viewer would fail due to incorrect double decoding.fileparameter retrieved fromURLSearchParamswas being passed todecodeURIComponent. SinceURLSearchParams.get()already decodes values, this caused a second round of decoding. This corrupted URLs containing encoded characters (like%2Fbecoming/), which broke signed URLs or paths requiring encoding.decodeURIComponentcall. Thefileparameter is now passed directly to the URL constructor, preserving the correct encoding.Testing
Verified manually using a reproduction case:
https://example.com/pdf?token=%2Ffoo...token=/foo(Incorrect, broke the token)....token=%2Ffoo(Correct, preserves encoding).