Issue 649961: nturl2path.url2pathname() mishandles /// (original) (raw)

Created on 2002-12-07 08:19 by mike_j_brown, last changed 2022-04-10 16:05 by admin. This issue is now closed.

Messages (5)
msg13541 - (view) Author: Mike Brown (mike_j_brown) Date: 2002-12-07 08:19
On Windows, urllib.url2pathname('///path/to/file') returns r'\\\path\to\file'. This path cannot be used in things like open() and os.access(). It should probably return r'\path\to\file'. In addition, '//localhost/path/to/file' is a special case that should become '\path\to\file'. I'll post this as a separate bug since it affects all file URIs.
msg13542 - (view) Author: Mike Brown (mike_j_brown) Date: 2004-12-27 07:12
Logged In: YES user_id=371366 See #649974 -- url2pathname() and pathname2url() are undocumented, platform-specific, and not really general-purpose. It probably should not be assumed that they are intended to produce values that are usable with open(), os.access(), or anything other than where they are currently used internally in urllib. The solution as proposed for #649974 is probably just to document the functions and discourage their general use. See the suggested diffs attached to that report.
msg13543 - (view) Author: Facundo Batista (facundobatista) * (Python committer) Date: 2004-12-28 00:32
Logged In: YES user_id=752496 Please, could you verify if this problem persists in Python 2.3.4 or 2.4? If yes, in which version? Can you provide a test case? If the problem is solved, from which version? Note that if you fail to answer in one month, I'll close this bug as "Won't fix". Thank you! . Facundo
msg13544 - (view) Author: Facundo Batista (facundobatista) * (Python committer) Date: 2004-12-28 00:32
Logged In: YES user_id=752496 The documentation for urllib states that: Although the urllib module contains (undocumented) routines to parse and unparse URL strings, the recommended interface for URL manipulation is in module urlparse. So, if you think that the files should also be modified, change the group of this bug to 2.4. Otherwise it will be closed as won't fix.
msg13545 - (view) Author: Mike Brown (mike_j_brown) Date: 2004-12-28 05:25
Logged In: YES user_id=371366 Ah, gotcha. I am closing this as "Wont Fix", myself. I have modified the description of #649974 to make it be a Documentation enhancement for 2.4. My proposed patches in that report will satisfy my concerns without going into unnecessary detail. Thanks! -Mike
History
Date User Action Args
2022-04-10 16:05:58 admin set github: 37578
2002-12-07 08:19:17 mike_j_brown create