Skip to content
Permalink
Browse files Browse the repository at this point in the history
transfers: Use g_file_query_exists() instead of g_file_test().
When checking for existing files, g_file_test (and os.path.exists)
both follow symbolic links, whereas g_file_query_exists() notices
the link itself.

In both cases the link (and not the link's target) would have been
overwritten, but now the recipient will know about it.
  • Loading branch information
mtwebster committed Sep 20, 2022
1 parent 5244c33 commit f4907ef
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/util.py
Expand Up @@ -263,7 +263,8 @@ def files_exist(base_names):
for name in base_names:
path = os.path.join(prefs.get_save_path(), name)
logging.debug("(server side) Checking if file or folder %s already exists." % (path,))
if GLib.file_test(path, GLib.FileTest.EXISTS):
file = Gio.File.new_for_path(path)
if file.query_exists(None):
return True

return False
Expand Down

0 comments on commit f4907ef

Please sign in to comment.