Skip to content

Incorrect sign in function signedUrl when filename contains special chars: !'()#*+? #334

@victornikitin

Description

@victornikitin

Function signedUrl works incorrect with filenames containig special chars.

Problem:
Filename for creating sign is converted with code:
pathname = url.parse(filename).pathname

But filename for returning url is converted with code:
return this.url(filename)

Function this.url includes conversion by internal function encodeSpecialCharacters, that converts special symbols: !'()#*+?. But url.parse does not convert these special chars. So results are different. Difference in url & sign cause S3 error SignatureDoesNotMatch.

Example:
For Filename: file (1).png
In sign is: file%20(1).png
In url is: file%20%281%29.png

No workaround:
I can't prepare filename by myself outside the knox. Because if I convert special chars in filename before knox, knox will double convert % char (% → %25) and sign will be incorect again. For this example: file%2520%25281%2529.png.

Please, help!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions