Correct conversion between URL and filename paths.

This commit is contained in:
Bastian Kleineidam 2011-03-11 10:38:17 +01:00
parent c6d2eab46c
commit ae109ed994
3 changed files with 9 additions and 6 deletions

View file

@ -5,6 +5,9 @@ Fixes:
Closes: SF bug #3196917
- checking: Prevent false positives when detecting the MIME type
of certain archive files.
- checking: Correct conversion between file URLs and encoded
filenames. Fixes false errors when handling files with Unicode
encodings.
- cmdline: Fix filename completion if path starts with ~
Changes:

View file

@ -69,7 +69,7 @@ def get_os_filename (path):
"""Return filesystem path for given URL path."""
if os.name == 'nt':
path = prepare_urlpath_for_nt(path)
return fileutil.pathencode(urllib.url2pathname(path))
return urllib.url2pathname(fileutil.pathencode(path))
def is_absolute_path (path):
@ -146,7 +146,7 @@ class FileUrl (urlbase.UrlBase):
if self.is_directory():
self.set_result(_("directory"))
else:
url = fileutil.pathencode(self.url)
url = urllib.url2pathname(fileutil.pathencode(self.url))
self.url_connection = urllib2.urlopen(url)
self.check_case_sensitivity()

View file

@ -4,8 +4,8 @@ real url file://%(curdir)s/%(datadir)s/dir/
name %(datadir)s/dir
valid
url %%ED%%BB%%AD%%AF%%BF.dat
cache key file://%(curdir)s/%(datadir)s/dir/%%ED%%BB%%AD%%AF%%BF.dat
real url file://%(curdir)s/%(datadir)s/dir/%%ED%%BB%%AD%%AF%%BF.dat
name í»­¯¿.dat
url %%C3%%AD%%C2%%BB%%C2%%AD%%C2%%AF%%C2%%BF.dat
cache key file://%(curdir)s/%(datadir)s/dir/%%C3%%AD%%C2%%BB%%C2%%AD%%C2%%AF%%C2%%BF.dat
real url file://%(curdir)s/%(datadir)s/dir/%%C3%%AD%%C2%%BB%%C2%%AD%%C2%%AF%%C2%%BF.dat
name í»­¯¿.dat
valid