From 712deb4396f8a23f6fcc3c3d2803d2bf510deae1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Mart=C3=AD?= Date: Wed, 30 Sep 2015 17:04:00 -0700 Subject: [PATCH] Don't use exists() on symlinks If they are broken, exists() will return false. islink() will return true in both cases. --- fdroidserver/update.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/fdroidserver/update.py b/fdroidserver/update.py index 29dbad8d..af5340c8 100644 --- a/fdroidserver/update.py +++ b/fdroidserver/update.py @@ -911,7 +911,7 @@ def make_index(apps, sortedids, apks, repodir, archive, categories): app[config['current_version_name_source']]) apklinkname = sanitized_name + '.apk' current_version_path = os.path.join(repodir, current_version_file) - if os.path.exists(apklinkname): + if os.path.islink(apklinkname): os.remove(apklinkname) os.symlink(current_version_path, apklinkname) # also symlink gpg signature, if it exists @@ -919,7 +919,7 @@ def make_index(apps, sortedids, apks, repodir, archive, categories): sigfile_path = current_version_path + extension if os.path.exists(sigfile_path): siglinkname = apklinkname + extension - if os.path.exists(siglinkname): + if os.path.islink(siglinkname): os.remove(siglinkname) os.symlink(sigfile_path, siglinkname)