Commit 8dc8cfbf authored by Marcin Mielniczuk's avatar Marcin Mielniczuk Committed by Philipp Hörist
Browse files

Drag & Drop: Show info message if paths are skipped

Related to #10544
parent f891fdc2
Pipeline #8588 passed with stages
in 3 minutes and 12 seconds
......@@ -965,12 +965,13 @@ class ChatControlBase(ChatCommandProcessor, CommandTools, EventHelper):
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)
......@@ -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