Skip to content

Commit 7a8586e

Browse files
committed
Fix matching empty string
1 parent d1d1954 commit 7a8586e

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

Lib/nturl2path.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ def url2pathname(url):
2626
# Skip past extra slash before UNC drive in URL path.
2727
url = url[1:]
2828
else:
29-
if url[:1] == '/' and url[2:3] in ':|':
29+
if url[:1] == '/' and url[2:3] in (':', '|'):
3030
# Skip past extra slash before DOS drive in URL path.
3131
url = url[1:]
3232
if url[1:2] == '|':

Lib/test/test_urllib.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1484,6 +1484,7 @@ def test_pathname2url_nonascii(self):
14841484
'test specific to Windows pathnames.')
14851485
def test_url2pathname_win(self):
14861486
fn = urllib.request.url2pathname
1487+
self.assertEqual(fn('/'), '\\')
14871488
self.assertEqual(fn('/C:/'), 'C:\\')
14881489
self.assertEqual(fn("///C|"), 'C:')
14891490
self.assertEqual(fn("///C:"), 'C:')

0 commit comments

Comments
 (0)