Skip to content

Commit

Permalink
Fixes #6747: OSError "The filename, directory name, or volume label s…
Browse files Browse the repository at this point in the history
…yntax is incorrect" in dragEnterEvent
  • Loading branch information
kozlovsky committed Jan 31, 2022
1 parent 285f749 commit 374888c
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions src/tribler-gui/tribler_gui/tribler_window.py
Original file line number Diff line number Diff line change
Expand Up @@ -1142,10 +1142,14 @@ def get_urls_from_dragndrop_list(cls, e):

def dragEnterEvent(self, e):
file_urls = self.get_urls_from_dragndrop_list(e)
if any(Path(uri_to_path(fu)).is_file() for fu in file_urls):
e.accept()
else:
e.ignore()
for fu in file_urls:
try:
if Path(uri_to_path(fu)).is_file():
e.accept()
return
except OSError:
pass
e.ignore()

def dropEvent(self, e):
file_urls = self.get_urls_from_dragndrop_list(e)
Expand Down

0 comments on commit 374888c

Please sign in to comment.