mirror of
https://github.com/YunoHost/yunohost.git
synced 2024-09-03 20:06:10 +02:00
[fix] Backup delete should delete symlink target
This commit is contained in:
parent
2decf86021
commit
46e388460c
1 changed files with 8 additions and 1 deletions
|
@ -2319,7 +2319,14 @@ def backup_delete(name):
|
||||||
archive_file = '%s/%s.tar.gz' % (ARCHIVES_PATH, name)
|
archive_file = '%s/%s.tar.gz' % (ARCHIVES_PATH, name)
|
||||||
info_file = "%s/%s.info.json" % (ARCHIVES_PATH, name)
|
info_file = "%s/%s.info.json" % (ARCHIVES_PATH, name)
|
||||||
|
|
||||||
for backup_file in [archive_file, info_file]:
|
files_to_delete = [archive_file, info_file]
|
||||||
|
|
||||||
|
# To handle the case where archive_file is in fact a symlink
|
||||||
|
actual_archive = os.path.realpath(archive_file)
|
||||||
|
if actual_archive != archive_file:
|
||||||
|
files_to_delete.append(actual_archive)
|
||||||
|
|
||||||
|
for backup_file in files_to_delete:
|
||||||
try:
|
try:
|
||||||
os.remove(backup_file)
|
os.remove(backup_file)
|
||||||
except:
|
except:
|
||||||
|
|
Loading…
Add table
Reference in a new issue