Fix crash on create package error due to missing rollback

This commit is contained in:
rubenwardy
2025-08-16 16:45:30 +01:00
parent a6fccc7c58
commit 66f918c1bf
2 changed files with 8 additions and 5 deletions

View File

@@ -306,10 +306,6 @@ def handle_create_edit(package: typing.Optional[Package], form: PackageForm, aut
"translation_url": form.translation_url.data,
})
if wasNew:
msg = f"Created package {author.username}/{form.name.data}"
add_audit_log(AuditSeverity.NORMAL, current_user, msg, package.get_url("packages.view"), package)
if wasNew and package.repo is not None:
import_repo_screenshot.delay(package.id)
@@ -322,6 +318,7 @@ def handle_create_edit(package: typing.Optional[Package], form: PackageForm, aut
return redirect(next_url)
except LogicError as e:
flash(e.message, "danger")
db.session.rollback()
@bp.route("/packages/new/", methods=["GET", "POST"])