Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[fix] adding a new test in case the info.json file exists but not the tar and vice versa #667

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
7 changes: 4 additions & 3 deletions src/yunohost/backup.py
Expand Up @@ -2189,11 +2189,14 @@ def backup_info(name, with_details=False, human_readable=False):

"""
archive_file = '%s/%s.tar.gz' % (ARCHIVES_PATH, name)

info_file = "%s/%s.info.json" % (ARCHIVES_PATH, name)
# Check file exist (even if it's a broken symlink)
if not os.path.lexists(archive_file):
raise YunohostError('backup_archive_name_unknown', name=name)

if not (os.path.lexists(archive_file) and os.path.exists(info_file)):
raise YunohostError('backup_archive_missing', name=name)

# If symlink, retrieve the real path
if os.path.islink(archive_file):
archive_file = os.path.realpath(archive_file)
Expand All @@ -2203,8 +2206,6 @@ def backup_info(name, with_details=False, human_readable=False):
raise YunohostError('backup_archive_broken_link',
path=archive_file)

info_file = "%s/%s.info.json" % (ARCHIVES_PATH, name)

if not os.path.exists(info_file):
tar = tarfile.open(archive_file, "r:gz")
info_dir = info_file + '.d'
Expand Down