Fix URL percent-encoding using space-padding instead of zero-padding#259
Open
bysiber wants to merge 1 commit intopypa:masterfrom
Open
Fix URL percent-encoding using space-padding instead of zero-padding#259bysiber wants to merge 1 commit intopypa:masterfrom
bysiber wants to merge 1 commit intopypa:masterfrom
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
URL percent-encoding in
Page.linksuses%2xformat which pads with a space instead of a zero for characters with ordinal values < 16.Problem
The format string
'%%%2x'produces space-padded hex values:Characters like newline (0x0a), tab (0x09), etc. matched by
_clean_rewould be encoded as% a,% 9, etc. — these are not valid percent-encoded sequences per RFC 3986 and would break URL parsing.Fix
Change
%2xto%02xto zero-pad the hex value.