mirror of
https://github.com/python/cpython.git
synced 2025-11-01 18:51:43 +00:00
GH-126601: pathname2url(): handle NTFS alternate data streams (#126760)
Adjust `pathname2url()` to encode embedded colon characters in Windows paths, rather than bailing out with an `OSError`. Co-authored-by: Steve Dower <steve.dower@microsoft.com>
This commit is contained in:
parent
e8bb053941
commit
fd133d4f21
4 changed files with 21 additions and 14 deletions
|
|
@ -1429,8 +1429,9 @@ class Pathname_Tests(unittest.TestCase):
|
|||
self.assertEqual(fn('C:\\a\\b%#c'), '///C:/a/b%25%23c')
|
||||
self.assertEqual(fn('C:\\a\\b\xe9'), '///C:/a/b%C3%A9')
|
||||
self.assertEqual(fn('C:\\foo\\bar\\spam.foo'), "///C:/foo/bar/spam.foo")
|
||||
# Long drive letter
|
||||
self.assertRaises(IOError, fn, "XX:\\")
|
||||
# NTFS alternate data streams
|
||||
self.assertEqual(fn('C:\\foo:bar'), '///C:/foo%3Abar')
|
||||
self.assertEqual(fn('foo:bar'), 'foo%3Abar')
|
||||
# No drive letter
|
||||
self.assertEqual(fn("\\folder\\test\\"), '/folder/test/')
|
||||
self.assertEqual(fn("\\\\folder\\test\\"), '//folder/test/')
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue