7258 7618 7837: let the win() stuff to windows, fix url/uri handling with non-ascii characters under linux and mac (not tested under mac)

This commit is contained in:
Jérôme Rapinat 2014-07-17 15:24:05 +02:00
parent 48763c8ade
commit a615ba35a4
2 changed files with 10 additions and 4 deletions

View File

@ -520,7 +520,10 @@ class GalleryTab(ButtonTab, DbGUIElement):
else: else:
files = sel_data.get_uris() files = sel_data.get_uris()
for file in files: for file in files:
d = conv_to_unicode((file.replace('\0',' ').strip()), None) if win():
d = conv_to_unicode((file.replace('\0',' ').strip()), None)
else:
d = file
protocol, site, mfile, j, k, l = urlparse(d) protocol, site, mfile, j, k, l = urlparse(d)
if protocol == "file": if protocol == "file":
name = url2pathname(mfile) name = url2pathname(mfile)

View File

@ -184,9 +184,12 @@ class MediaView(ListView):
#modern file managers provide URI_LIST. For Windows split sel_data.data #modern file managers provide URI_LIST. For Windows split sel_data.data
files = sel_data.get_uris() files = sel_data.get_uris()
for file in files: for file in files:
clean_string = conv_to_unicode( if win():
file.replace('\0',' ').replace("\r", " ").strip(), clean_string = conv_to_unicode(
None) file.replace('\0',' ').replace("\r", " ").strip(),
None)
else:
clean_string = file
protocol, site, mfile, j, k, l = urlparse(clean_string) protocol, site, mfile, j, k, l = urlparse(clean_string)
if protocol == "file": if protocol == "file":
name = url2pathname(mfile) name = url2pathname(mfile)