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.
This commit is contained in:
parent
e335055709
commit
91211e189d
|
@ -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':
|
||||
|
|
|
@ -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 = []
|
||||
|
|
Loading…
Reference in New Issue