This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Title: Fix "file:" URL to have right no. of /'s
Type: Stage:
Components: Library (Lib) Versions:
Status: closed Resolution: accepted
Dependencies: Superseder:
Assigned To: nnorwitz Nosy List: callenish, fdrake, nnorwitz
Priority: normal Keywords: patch

Created on 2002-08-06 19:26 by callenish, last changed 2022-04-10 16:05 by admin. This issue is now closed.

File name Uploaded Description Edit
urlparse.patch callenish, 2002-08-06 19:26
Messages (4)
msg40855 - (view) Author: Bruce Atherton (callenish) Date: 2002-08-06 19:26
If you run urlparse.urljoin() on a file: URL, the resulting URL 
has together with the wrong number of '/'s in it.

Properly formed, the URL (assuming no netloc) should have 
three slashes, so that it looks like "file:///...". The current 
code drops that down to one.

The error appears to be in a condition in urlunsplit(). It 
doesn't show up except in this one instance because the 
test is only run iff the scheme is in the list of those that can 
take a netloc and there is no netloc present in the URL. 
Apparently, this is pretty rare.

Patch attached that corrects the condition.
msg40856 - (view) Author: Neal Norwitz (nnorwitz) * (Python committer) Date: 2002-09-17 21:22
Logged In: YES 

Not sure who is best to review this?  Fred?  Jeremy? 
Someone else?

This patch works for me.  I have a test too.  Assign back to
me if you want me to check it in.
msg40857 - (view) Author: Fred Drake (fdrake) (Python committer) Date: 2002-09-25 14:46
Logged In: YES 

Looks good to me; go ahead and check it in with the tests.

msg40858 - (view) Author: Neal Norwitz (nnorwitz) * (Python committer) Date: 2002-09-25 19:22
Logged In: YES 

Checked in as:
 * 1.33 and
 * 1.7 and
 * output/test_urlparse
Date User Action Args
2022-04-10 16:05:33adminsetgithub: 36991
2002-08-06 19:26:03callenishcreate