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

URL encode non-alpha querystring parameters #139

Merged
merged 2 commits into from
Dec 5, 2021

Conversation

varju
Copy link
Contributor

@varju varju commented Dec 3, 2021

Fixes #138

@okigan
Copy link
Owner

okigan commented Dec 4, 2021

@varju seems github added manual approval before commit checks are run for new commuters -- I've approved that for you.

Thanks for PR -- have a look at 3.6 build above (and I think mac builds will run once that is resolved).

@varju
Copy link
Contributor Author

varju commented Dec 4, 2021

Thanks for PR -- have a look at 3.6 build above

Darn. I included examples in that test of all the character classes that AWS says should not be URL encoded. It looks like Python 3.6's URL encoder is encoding the ~ character.

Given that 3.6 hits end of life at the end of this month, is there any chance you'd consider dropping support for it? The alternative would be hand-rolling a URL encoder similar to what the python-aws-sig project did, and that feels a bit heavy.

@okigan
Copy link
Owner

okigan commented Dec 4, 2021 via email

@varju
Copy link
Contributor Author

varju commented Dec 4, 2021

Just reading some docs some more, I think the encoding change happened in 3.7. The urllib.parse.quote docs say:

Changed in version 3.7: Moved from RFC 2396 to RFC 3986 for quoting URL strings. “~” is now included in the set of unreserved characters.

That said, I think we can implement AWS-compatible encoding in a way that doesn't require quite as much code as that link I shared earlier, and with support for Python 3.6.

What do you think of the latest push?

@okigan
Copy link
Owner

okigan commented Dec 5, 2021

All checks passed - nice!, I’ll re-review when I get home later today.

@okigan
Copy link
Owner

okigan commented Dec 5, 2021

looks good to me

@okigan okigan merged commit 230eed7 into okigan:master Dec 5, 2021
@okigan
Copy link
Owner

okigan commented Dec 8, 2021

@varju please confirm all is resolved. Thanks

@varju
Copy link
Contributor Author

varju commented Dec 8, 2021 via email

@kibiz0r
Copy link

kibiz0r commented Feb 10, 2022

What if the caller has already percent-encoded the query string?

(Spoiler: Our scripts are doing just that.)

In our case, we can simply stop doing the percent-encoding on our end, which is actually a win for us. But just FYI, this might introduce a headache for people that don't have that option. Browsers seem to only percent-encode pasted URLs "if necessary". Might be good to take a similar approach here.

@varju varju deleted the url-encode-query-string branch February 10, 2022 17:29
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.

Commas in querystring are not URL encoded
3 participants