diff --git a/Lib/test/test_urlparse.py b/Lib/test/test_urlparse.py index 4ae6ed33858ce2..cd9173e4d842c5 100644 --- a/Lib/test/test_urlparse.py +++ b/Lib/test/test_urlparse.py @@ -157,6 +157,12 @@ def test_roundtrips(self): ('file:///tmp/junk.txt', ('file', '', '/tmp/junk.txt', '', '', ''), ('file', '', '/tmp/junk.txt', '', '')), + ('file:////tmp/junk.txt', + ('file', '', '//tmp/junk.txt', '', '', ''), + ('file', '', '//tmp/junk.txt', '', '')), + ('file://///tmp/junk.txt', + ('file', '', '///tmp/junk.txt', '', '', ''), + ('file', '', '///tmp/junk.txt', '', '')), ('imap://mail.python.org/mbox1', ('imap', 'mail.python.org', '/mbox1', '', '', ''), ('imap', 'mail.python.org', '/mbox1', '', '')), diff --git a/Lib/urllib/parse.py b/Lib/urllib/parse.py index b6608783a89471..9de24548612a98 100644 --- a/Lib/urllib/parse.py +++ b/Lib/urllib/parse.py @@ -490,7 +490,7 @@ def urlunsplit(components): empty query; the RFC states that these are equivalent).""" scheme, netloc, url, query, fragment, _coerce_result = ( _coerce_args(*components)) - if netloc or (scheme and scheme in uses_netloc and url[:2] != '//'): + if netloc or (scheme and scheme in uses_netloc): if url and url[:1] != '/': url = '/' + url url = '//' + (netloc or '') + url if scheme: diff --git a/Misc/NEWS.d/next/Library/2019-08-27-01-16-50.bpo-34276.4NIAiy.rst b/Misc/NEWS.d/next/Library/2019-08-27-01-16-50.bpo-34276.4NIAiy.rst new file mode 100644 index 00000000000000..d48bf3659e408d --- /dev/null +++ b/Misc/NEWS.d/next/Library/2019-08-27-01-16-50.bpo-34276.4NIAiy.rst @@ -0,0 +1 @@ +Makes sure that file URIs with multiple leading slashes (file:////, etc.) are properly round-tripped by urllib.parse. Patch by Ashwin Ramaswami pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy