Verified Commit 3fe77688 authored by Marcin Mielniczuk's avatar Marcin Mielniczuk
Browse files

Show an info message if some of the paths are skipped during a drag&drop.

Related to #10544
parent 5e8ef4a3
Pipeline #8041 passed with stages
in 7 minutes and 20 seconds
......@@ -967,12 +967,13 @@ class ChatControlBase(ChatCommandProcessor, CommandTools, EventHelper):
self.xml.drop_area.set_no_show_all(False)
self.xml.drop_area.show_all()
def drag_data_file_transfer(self, selection):
def drag_data_file_transfer(self, selection: Gtk.SelectionData) -> None:
# we may have more than one file dropped
uri_splitted = selection.get_uris()
for uri in uri_splitted:
path = helpers.get_file_path_from_dnd_dropped_uri(uri)
if not os.path.isfile(path): # is it a file?
self.add_info_message(_("The following file could not be accessed and was not uploaded: ") + path)
continue
self._start_filetransfer(path)
......
......@@ -352,7 +352,7 @@ def build_command(executable, parameter):
command = '%s "%s"' % (executable, parameter)
return command
def get_file_path_from_dnd_dropped_uri(uri):
def get_file_path_from_dnd_dropped_uri(uri: str) -> str:
path = urllib.parse.unquote(uri) # escape special chars
path = path.strip('\r\n\x00') # remove \r\n and NULL
# get the path to file
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment