diff --git a/ChangeLog b/ChangeLog index 49d11668..8127dbf7 100644 --- a/ChangeLog +++ b/ChangeLog @@ -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. diff --git a/linkcheck/checker/fileurl.py b/linkcheck/checker/fileurl.py index 817d2e90..3791dd92 100644 --- a/linkcheck/checker/fileurl.py +++ b/linkcheck/checker/fileurl.py @@ -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()