From 1a1f1e99edc67f3fa8cdd623d9833c87a3fc73d6 Mon Sep 17 00:00:00 2001 From: Pierre-Yves Chibon Date: Apr 03 2018 08:24:55 +0000 Subject: Do not update the CHECKSUMS file if the file was already uploaded Basically, do not trigger the task to update the CHECKSUMS file if the file failed to be uploaded. Fixes https://pagure.io/pagure/issue/3121 Signed-off-by: Pierre-Yves Chibon --- diff --git a/pagure/ui/repo.py b/pagure/ui/repo.py index 9fb93d4..3acfa4a 100644 --- a/pagure/ui/repo.py +++ b/pagure/ui/repo.py @@ -989,21 +989,21 @@ def new_release(repo, username=None, namespace=None): if os.path.exists(dest): raise pagure.exceptions.PagureException( 'This tarball has already been uploaded') - else: - filestream.save(dest) - flask.flash('File "%s" uploaded' % filename) + + filestream.save(dest) + flask.flash('File "%s" uploaded' % filename) + + task = pagure.lib.tasks.update_checksums_file.delay( + folder=folder, filenames=filenames) + _log.info( + 'Updating checksums for %s of project %s in task: %s' % ( + filenames, repo.fullname, task.id)) except pagure.exceptions.PagureException as err: flask.flash(str(err), 'error') except Exception as err: # pragma: no cover _log.exception(err) flask.flash('Upload failed', 'error') - task = pagure.lib.tasks.update_checksums_file.delay( - folder=folder, filenames=filenames) - _log.info( - 'Updating checksums for %s of project %s in task: %s' % ( - filenames, repo.fullname, task.id)) - return flask.redirect(flask.url_for( 'ui_ns.view_tags', repo=repo.name, username=username, namespace=repo.namespace))