summaryrefslogtreecommitdiffstats
path: root/Lib/nturl2path.py
Commit message (Collapse)AuthorAgeFilesLines
* GH-127236: `pathname2url()`: generate RFC 1738 URL for absolute POSIX path ↵Barney Gale2024-11-251-8/+12
| | | | | | | | | | | | | | | (#127194) When handed an absolute Windows path such as `C:\foo` or `//server/share`, the `urllib.request.pathname2url()` function returns a URL with an authority section, such as `///C:/foo` or `//server/share` (or before GH-126205, `////server/share`). Only the `file:` prefix is omitted. But when handed an absolute POSIX path such as `/etc/hosts`, or a Windows path of the same form (rooted but lacking a drive), the function returns a URL without an authority section, such as `/etc/hosts`. This patch corrects the discrepancy by adding a `//` prefix before drive-less, rooted paths when generating URLs.
* GH-125866: Preserve Windows drive letter case in file URIs (#127138)Barney Gale2024-11-231-2/+2
| | | | | Stop converting Windows drive letters to uppercase in `urllib.request.pathname2url()` and `url2pathname()`. This behaviour is unnecessary and inconsistent with pathlib's file URI implementation.
* GH-127078: `url2pathname()`: handle extra slash before UNC drive in URL path ↵Barney Gale2024-11-221-0/+3
| | | | | | | (#127132) Decode a file URI like `file://///server/share` as a UNC path like `\\server\share`. This form of file URI is created by software the simply prepends `file:///` to any absolute Windows path.
* GH-126766: `url2pathname()`: handle 'localhost' authority (#127129)Barney Gale2024-11-221-4/+7
| | | | | Discard any 'localhost' authority from the beginning of a `file:` URI. As a result, file URIs like `//localhost/etc/hosts` are correctly decoded as `/etc/hosts`.
* GH-126601: `pathname2url()`: handle NTFS alternate data streams (#126760)Barney Gale2024-11-221-12/+10
| | | | | | 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>
* GH-126766: `url2pathname()`: handle empty authority section. (#126767)Barney Gale2024-11-141-4/+3
| | | | | Discard two leading slashes from the beginning of a `file:` URI if they introduce an empty authority section. As a result, file URIs like `///etc/hosts` are correctly parsed as `/etc/hosts`.
* GH-120423: `pathname2url()`: handle forward slashes in Windows paths (#126593)Barney Gale2024-11-121-6/+7
| | | | Adjust `urllib.request.pathname2url()` so that forward slashes in Windows paths are handled identically to backward slashes.
* GH-126212: Fix removal of slashes in file URIs on Windows (#126214)Barney Gale2024-11-081-19/+6
| | | | | | Adjust `urllib.request.pathname2url()` and `url2pathname()` so that they don't remove slashes from Windows DOS drive paths and URLs. There was no basis for this behaviour, and it conflicts with how UNC and POSIX paths are handled.
* GH-126205: Fix conversion of UNC paths to file URIs (#126208)Barney Gale2024-10-301-6/+1
| | | File URIs for Windows UNC paths should begin with two slashes, not four.
* bpo-43607: Fix urllib handling of Windows paths with \\?\ prefix (GH-25539)Steve Dower2021-04-231-1/+9
|
* bpo-29836: Remove nturl2path from test_sundry and amend the module docstring ↵Jim Fasarakis-Hilliard2017-03-171-1/+6
| | | | | (GH-694) The module is implicitly tested through test_urllib.
* Issue21160: Correct comments in nturl2path. Patch by Jurko Gospodnetić.Serhiy Storchaka2015-10-241-5/+7
|
* Replace IOError with OSError (#16715)Andrew Svetlov2012-12-251-2/+2
|
* Fix Issue11474 - fix url2pathname() handling of '/C|/' on WindowsSenthil Kumaran2011-04-141-1/+4
|
* Fix for issue1153027, making Py3k changes similar to fix in issue918368.Senthil Kumaran2009-05-051-1/+1
| | | | | | | This will address: a) urllib/ in py3k, b) urllib in py2x is addressed by issue918368. c) urllib2 in py2x was already addressed in Revision 43132.
* follow-up of r64385: rename urllib.quote in nturl2pathAmaury Forgeot d'Arc2008-06-181-7/+7
| | | | and remove assertions & debugger when ssl is not present
* Raise statement normalization in Lib/.Collin Winter2007-08-301-2/+2
|
* Bug #649974: make docstrings for url2pathname consistentGeorg Brandl2005-12-261-17/+12
|
* Bug #1378455: a problem of urllib using open_local_fileGeorg Brandl2005-12-151-0/+2
|
* Use string.ascii_letters instead of string.letters.Fred Drake2001-07-201-2/+2
| | | | Remove unused import.
* removed __all__ from several modulesSkip Montanaro2001-02-181-2/+0
|
* String method conversion.Eric S. Raymond2001-02-091-10/+10
|
* added several more __all__ listsSkip Montanaro2001-02-061-0/+2
|
* Whitespace normalization.Tim Peters2001-01-151-53/+53
|
* Add 'r' to docstrings to avoid expanded backslash escapes. (Ka-Ping Yee)Guido van Rossum2000-05-301-2/+4
|
* More trivial comment -> docstring transformations by Ka-Ping Yee,Guido van Rossum2000-02-041-4/+1
| | | | | | | | | | | | | | | | | | who writes: Here is batch 2, as a big collection of CVS context diffs. Along with moving comments into docstrings, i've added a couple of missing docstrings and attempted to make sure more module docstrings begin with a one-line summary. I did not add docstrings to the methods in profile.py for fear of upsetting any careful optimizations there, though i did move class documentation into class docstrings. The convention i'm using is to leave credits/version/copyright type of stuff in # comments, and move the rest of the descriptive stuff about module usage into module docstrings. Hope this is okay.
* Sjoerd Mullender writes:Guido van Rossum1999-03-181-0/+10
| | | | | | | | Pathnames of files on other hosts in the same domain (\\host\path\to\file) are not translated correctly to URLs and back. The URL should be something like file:////host/path/to/file. Note that a combination of drive letter and remote host is not possible.
* From: Sjoerd MullenderGuido van Rossum1999-03-121-14/+15
| | | | | | The filename to URL conversion didn't properly quote special characters. The URL to filename didn't properly unquote special chatacters.
* Allow paths without drive specifier (Jack).Guido van Rossum1997-08-121-4/+8
|
* url2path for NTGuido van Rossum1996-06-261-0/+52