fix nt path name for network paths

git-svn-id: https://linkchecker.svn.sourceforge.net/svnroot/linkchecker/trunk/linkchecker@2284 e7d03fd6-7b0d-0410-9947-9c21f3af8025
This commit is contained in:
calvin 2005-02-07 15:41:53 +00:00
parent 973b6d5098
commit 55652cabc0
2 changed files with 19 additions and 1 deletions

View file

@ -17,6 +17,11 @@
Type: bugfix
Changed: linkcheck/url.py, linkcheck/tests/test_url.py
* Fix NT path name for network paths.
Type: bugfix
Closes: SF bug #1117839
Changed: linkcheck/checker/fileurl.py
2.3 "Napoleon Dynamite" (released 3.2.2005)
* Use and require Python >= 2.4.

View file

@ -53,6 +53,16 @@ def get_files (dirname):
return files
def prepare_urlpath_for_nt (path):
"""
URLs like 'file://server/path/' result in a path named '/server/path'.
However urllib.url2pathname expects '////server/path'.
"""
if '|' not in path:
return "////"+path.lstrip("/")
return path
def get_nt_filename (path):
"""
Return case sensitive filename for NT path.
@ -153,7 +163,10 @@ class FileUrl (urlbase.UrlBase):
return True
def get_os_filename (self):
return urllib.url2pathname(self.urlparts[2])
path = self.urlparts[2]
if os.name == 'nt':
path = prepare_urlpath_for_nt(path)
return urllib.url2pathname(path)
def is_directory (self):
filename = self.get_os_filename()