Skip to content

Commit a9eba07

Browse files
committed
Don't force encode +
Before: >>> URL(scheme='https', host='foo', query={'f+o o': 'b+a r'}).to_text() 'https://foo/?f%2Bo o=b%2Ba r' After: >>> URL(scheme='https', host='foo', query={'f+o o': 'b+a r'}).to_text() 'https://foo/?f+o o=b+a r' If spaces pass unencoded, surely + can.
1 parent b69be9e commit a9eba07

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

src/hyperlink/_url.py

+6-6
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@ def __nonzero__(self):
183183
_SCHEMELESS_PATH_DELIMS = _ALL_DELIMS - _SCHEMELESS_PATH_SAFE
184184
_FRAGMENT_SAFE = _UNRESERVED_CHARS | _PATH_SAFE | set(u"/?")
185185
_FRAGMENT_DELIMS = _ALL_DELIMS - _FRAGMENT_SAFE
186-
_QUERY_VALUE_SAFE = _UNRESERVED_CHARS | _FRAGMENT_SAFE - set(u"&+")
186+
_QUERY_VALUE_SAFE = _UNRESERVED_CHARS | _FRAGMENT_SAFE - set(u"&")
187187
_QUERY_VALUE_DELIMS = _ALL_DELIMS - _QUERY_VALUE_SAFE
188188
_QUERY_KEY_SAFE = _UNRESERVED_CHARS | _QUERY_VALUE_SAFE - set(u"=")
189189
_QUERY_KEY_DELIMS = _ALL_DELIMS - _QUERY_KEY_SAFE
@@ -931,9 +931,9 @@ class URL(object):
931931
https://example.com/hello/world
932932
933933
The constructor runs basic type checks. All strings are expected
934-
to be decoded (:class:`unicode` in Python 2). All arguments are
935-
optional, defaulting to appropriately empty values. A full list of
936-
constructor arguments is below.
934+
to be text (:class:`str` in Python 3, :class:`unicode` in Python 2). All
935+
arguments are optional, defaulting to appropriately empty values. A full
936+
list of constructor arguments is below.
937937
938938
Args:
939939
scheme: The text name of the scheme.
@@ -943,9 +943,9 @@ class URL(object):
943943
it is known. See the ``SCHEME_PORT_MAP`` and
944944
:func:`register_default_port` for more info.
945945
path: A tuple of strings representing the slash-separated parts of the
946-
path.
946+
path, each percent-encoded.
947947
query: The query parameters, as a dictionary or as an sequence of
948-
key-value pairs.
948+
percent-encoded key-value pairs.
949949
fragment: The fragment part of the URL.
950950
rooted: A rooted URL is one which indicates an absolute path.
951951
This is True on any URL that includes a host, or any relative URL

0 commit comments

Comments
 (0)