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

(Encoded)URL round-tripping of + in query #146

Merged
merged 2 commits into from
Dec 29, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions src/hyperlink/_url.py
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ def __nonzero__(self):
_SCHEMELESS_PATH_DELIMS = _ALL_DELIMS - _SCHEMELESS_PATH_SAFE
_FRAGMENT_SAFE = _UNRESERVED_CHARS | _PATH_SAFE | set(u"/?")
_FRAGMENT_DELIMS = _ALL_DELIMS - _FRAGMENT_SAFE
_QUERY_VALUE_SAFE = _UNRESERVED_CHARS | _FRAGMENT_SAFE - set(u"&+")
_QUERY_VALUE_SAFE = _UNRESERVED_CHARS | _FRAGMENT_SAFE - set(u"&")
_QUERY_VALUE_DELIMS = _ALL_DELIMS - _QUERY_VALUE_SAFE
_QUERY_KEY_SAFE = _UNRESERVED_CHARS | _QUERY_VALUE_SAFE - set(u"=")
_QUERY_KEY_DELIMS = _ALL_DELIMS - _QUERY_KEY_SAFE
Expand Down Expand Up @@ -931,9 +931,9 @@ class URL(object):
https://example.com/hello/world

The constructor runs basic type checks. All strings are expected
to be decoded (:class:`unicode` in Python 2). All arguments are
optional, defaulting to appropriately empty values. A full list of
constructor arguments is below.
to be text (:class:`str` in Python 3, :class:`unicode` in Python 2). All
arguments are optional, defaulting to appropriately empty values. A full
list of constructor arguments is below.

Args:
scheme: The text name of the scheme.
Expand All @@ -943,9 +943,9 @@ class URL(object):
it is known. See the ``SCHEME_PORT_MAP`` and
:func:`register_default_port` for more info.
path: A tuple of strings representing the slash-separated parts of the
path.
path, each percent-encoded.
query: The query parameters, as a dictionary or as an sequence of
key-value pairs.
percent-encoded key-value pairs.
fragment: The fragment part of the URL.
rooted: A rooted URL is one which indicates an absolute path.
This is True on any URL that includes a host, or any relative URL
Expand Down
2 changes: 2 additions & 0 deletions src/hyperlink/test/test_url.py
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,8 @@
"https://example.com/?a=%23", # hash in query param value
"https://example.com/?a=%26", # ampersand in query param value
"https://example.com/?a=%3D", # equals in query param value
"https://example.com/?foo+bar=baz", # plus in query param name
"https://example.com/?foo=bar+baz", # plus in query param value
# double-encoded percent sign in all percent-encodable positions:
"http://(%2525):(%2525)@example.com/(%2525)/?(%2525)=(%2525)#(%2525)",
# colon in first part of schemeless relative url
Expand Down