[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

file:/// URLs using Python's urlparse.urljoin() (was Subversion portability)

From: Bruce Atherton <bruce_at_callenish.com>
Date: 2002-08-07 03:34:49 CEST

At 02:29 PM 8/5/2002 -0500, Karl Fogel wrote:
>Is your workaround below still applicable, or did we solve this some
>other way? I didn't see anything in the logs indicating that this had
>been applied, nor that the problem had been addressed...

This wasn't a patch to a specific file, it was a hack to add whenever
someone wanted to use the Python urlparse.urljoin() method and still keep
the proper file:/// format. Grepping through the Subversion codebase now I
don't see urljoin() being used anywhere, probably at least in part because
of the slash-stripping bug.

I guess the hack is still applicable for anyone that wants to write a
python test that uses urlparse.urljoin() with file:/// URLs in a portable
way. I don't think there is anything specific that needs to be done about
it, though. I've changed the subject to make it easier to find in case
anyone needs it.

Thanks for reminding me about this. It prompted me to send in the patch to
fix the underlying Python bug.

[hack follows]
> # FIXME: On at least some versions of Python, a bug in urlparse.urljoin()
> # strips required slashes out of a "file:" URL. This repairs the damage.
> # Once Python is fixed to get it right, the required Python version
> # should be upped and this code should be stripped.
> import re
>
> find_bad_url = re.compile("file:/[^/]")
> if (find_bad_url.match(urlstring)) is not None:
> urlstring = urlstring[0:5] + "//" + urlstring[5:]
Received on Wed Aug 7 03:35:25 2002

This is an archived mail posted to the Subversion Dev mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.