mirror of
https://github.com/mozilla/pdf.js.git
synced 2026-08-06 22:37:23 +02:00
`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 #19990). It fixes #20137.