From ff16c4610197ca5ccca796398f3171378b840a4a Mon Sep 17 00:00:00 2001 From: Ashwin Ramaswami Date: Thu, 15 Aug 2019 03:15:30 +0000 Subject: [PATCH 1/3] fix: always add double slash if scheme is in uses_netloc --- Lib/test/test_urlparse.py | 6 ++++++ Lib/urllib/parse.py | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) 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: From 151e39c59b9c7255d6db672d74ae20e32cbe5df6 Mon Sep 17 00:00:00 2001 From: "blurb-it[bot]" <43283697+blurb-it[bot]@users.noreply.github.com> Date: Tue, 27 Aug 2019 01:16:54 +0000 Subject: [PATCH 2/3] =?UTF-8?q?=F0=9F=93=9C=F0=9F=A4=96=20Added=20by=20blu?= =?UTF-8?q?rb=5Fit.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../NEWS.d/next/Library/2019-08-27-01-16-50.bpo-34276.4NIAiy.rst | 1 + 1 file changed, 1 insertion(+) create mode 100644 Misc/NEWS.d/next/Library/2019-08-27-01-16-50.bpo-34276.4NIAiy.rst 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..0359babf27d61f --- /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. Patch by Ashwin Ramaswami \ No newline at end of file From 0e177fda981adcc83ecda2e84410a5470aee7c81 Mon Sep 17 00:00:00 2001 From: Ashwin Ramaswami Date: Mon, 26 Aug 2019 18:17:25 -0700 Subject: [PATCH 3/3] Update 2019-08-27-01-16-50.bpo-34276.4NIAiy.rst --- .../next/Library/2019-08-27-01-16-50.bpo-34276.4NIAiy.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 index 0359babf27d61f..d48bf3659e408d 100644 --- 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 @@ -1 +1 @@ -Makes sure that file URIs with multiple leading slashes (file:////, etc.) are properly round-tripped. Patch by Ashwin Ramaswami \ No newline at end of file +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