Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Correctly canonicalize query param spaces #18

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

lionel-rowe
Copy link

@lionel-rowe lionel-rowe commented Feb 15, 2023

This, along with lucacasonato/deno_s3#55, will fix lucacasonato/deno_s3#54.

URLSearchParams#toString() canonicalizes spaces in keys or values to +:

new URL('https://example.com/?a%20b=c%20d').searchParams.toString() // 'a+b=c+d'

Whereas AWS requires them to be percent-encoded. Per https://docs.aws.amazon.com/general/latest/gr/create-signed-request.html#create-canonical-request:

CanonicalQueryString – The URL-encoded query string parameters, separated by ampersands (&). Percent-encode reserved characters, including the space character.

@benatkin
Copy link

I'm interested in this library, and I think I would need this to be able to use it.

I saw there's a test in the s3 PR, perhaps one could be added here as well?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Prefix key containing space throws S3Error with 403 SignatureDoesNotMatch response
2 participants