From 91211e189df36713ef8d99d3e221212a211d486b Mon Sep 17 00:00:00 2001 From: js Date: Sat, 10 May 2008 23:21:28 +0000 Subject: [PATCH] Fix DnD FT on Windows: * Fix helpers.py so URL is decoded correctly. * Fix code in roster_window.py so the \0 that's alway the last file on win32 is ignored. This also fixes and closes #2398. --- src/common/helpers.py | 4 ++-- src/roster_window.py | 4 ++++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/common/helpers.py b/src/common/helpers.py index 6250ef037..8e9666e30 100644 --- a/src/common/helpers.py +++ b/src/common/helpers.py @@ -585,10 +585,10 @@ def play_sound_file(path_to_soundfile): exec_command(command) def get_file_path_from_dnd_dropped_uri(uri): - path = urllib.url2pathname(uri) # escape special chars + path = urllib.unquote(uri) # escape special chars path = path.strip('\r\n\x00') # remove \r\n and NULL # get the path to file - if path.startswith('file:\\\\\\'): # windows + if re.match('^file:///[a-zA-Z]:/', path): # windows path = path[8:] # 8 is len('file:///') elif path.startswith('file://'): # nautilus, rox if sys.platform == 'darwin': diff --git a/src/roster_window.py b/src/roster_window.py index 1fee45872..f3169c759 100644 --- a/src/roster_window.py +++ b/src/roster_window.py @@ -3781,6 +3781,10 @@ class RosterWindow: jid_dest) uri = data.strip() uri_splitted = uri.split() # we may have more than one file dropped + try: + uri_splitted.remove('\0') # This is always the last element in windows + except ValueError: + pass nb_uri = len(uri_splitted) # Check the URIs bad_uris = []