mirror of
https://github.com/python/cpython.git
synced 2025-08-23 10:16:01 +00:00
Issue21160: Correct comments in nturl2path. Patch by Jurko Gospodnetić.
This commit is contained in:
parent
677744b386
commit
458123bd18
1 changed files with 7 additions and 5 deletions
|
@ -4,9 +4,11 @@ def url2pathname(url):
|
||||||
"""OS-specific conversion from a relative URL of the 'file' scheme
|
"""OS-specific conversion from a relative URL of the 'file' scheme
|
||||||
to a file system path; not recommended for general use."""
|
to a file system path; not recommended for general use."""
|
||||||
# e.g.
|
# e.g.
|
||||||
# ///C|/foo/bar/spam.foo
|
# ///C|/foo/bar/spam.foo
|
||||||
# becomes
|
# and
|
||||||
# C:\foo\bar\spam.foo
|
# ///C:/foo/bar/spam.foo
|
||||||
|
# become
|
||||||
|
# C:\foo\bar\spam.foo
|
||||||
import string, urllib.parse
|
import string, urllib.parse
|
||||||
# Windows itself uses ":" even in URLs.
|
# Windows itself uses ":" even in URLs.
|
||||||
url = url.replace(':', '|')
|
url = url.replace(':', '|')
|
||||||
|
@ -39,9 +41,9 @@ def pathname2url(p):
|
||||||
"""OS-specific conversion from a file system path to a relative URL
|
"""OS-specific conversion from a file system path to a relative URL
|
||||||
of the 'file' scheme; not recommended for general use."""
|
of the 'file' scheme; not recommended for general use."""
|
||||||
# e.g.
|
# e.g.
|
||||||
# C:\foo\bar\spam.foo
|
# C:\foo\bar\spam.foo
|
||||||
# becomes
|
# becomes
|
||||||
# ///C|/foo/bar/spam.foo
|
# ///C:/foo/bar/spam.foo
|
||||||
import urllib.parse
|
import urllib.parse
|
||||||
if not ':' in p:
|
if not ':' in p:
|
||||||
# No drive specifier, just convert slashes and quote the name
|
# No drive specifier, just convert slashes and quote the name
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue