Fix not being able to delete cover image

This commit is contained in:
rubenwardy 2020-12-10 23:07:13 +00:00
parent fc3a481e6f
commit dfa5d0c5a7

@ -157,6 +157,10 @@ def delete_screenshot(package, id):
flash("Permission denied", "danger") flash("Permission denied", "danger")
return redirect(url_for("homepage.home")) return redirect(url_for("homepage.home"))
if package.cover_image == screenshot:
package.cover_image = None
db.session.merge(package)
db.session.delete(screenshot) db.session.delete(screenshot)
db.session.commit() db.session.commit()