Skip to content

[Bug]: decodeURIComponent is running multiple times on viewer.html with an option file url #20264

@nvangnoob

Description

@nvangnoob

Attach (recommended) or Link to PDF file

azure blob sas url

Web browser and its version

Edge

Operating system and its version

Windows 11

PDF.js version

5.4.149

Is the bug present in the latest PDF.js version?

Yes

Is a browser extension

No

Steps to reproduce the problem

Using the viewer.html and passing the option file of an encodeURIComponent of an azure blob sas url

What is the expected behavior?

Pdf should load from azure blob storage.

What went wrong?

Gets a 403 error from azure blob storage because the sig in the url is incorrect.

Image

Link to a viewer

No response

Additional context

Was working fine on v5.3.31
It seems to run decodeURIComponent multiple times on the url and changes the sig to wrong value.

Example:
signature from azure blob sas url

  • sig=Dfv2AKFDd6SuL5egYH2%2BXuw5b1We8qENZ1xhTkTZs1k%3D

after my encodeURIComponent on the sas url passed in the viewer option

  • sig%3dDfv2AKFDd6SuL5egYH2%252BXuw5b1We8qENZ1xhTkTZs1k%253D

pdf.js sending fetch with sig

  • sig=Dfv2AKFDd6SuL5egYH2+Xuw5b1We8qENZ1xhTkTZs1k=

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions