diff --git a/app/blueprints/api/endpoints.py b/app/blueprints/api/endpoints.py
index e64b7ccc..85026e4b 100644
--- a/app/blueprints/api/endpoints.py
+++ b/app/blueprints/api/endpoints.py
@@ -15,6 +15,7 @@
# along with this program. If not, see .
import math
+import os
from functools import wraps
from typing import List
@@ -343,6 +344,8 @@ def delete_release(token: APIToken, package: Package, id: int):
db.session.delete(release)
db.session.commit()
+ os.remove(release.file_path)
+
return jsonify({"success": True})
@@ -414,6 +417,8 @@ def delete_screenshot(token: APIToken, package: Package, id: int):
db.session.delete(ss)
db.session.commit()
+ os.remove(ss.file_path)
+
return jsonify({ "success": True })
diff --git a/app/blueprints/packages/releases.py b/app/blueprints/packages/releases.py
index b763be49..25d922e1 100644
--- a/app/blueprints/packages/releases.py
+++ b/app/blueprints/packages/releases.py
@@ -13,6 +13,7 @@
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see .
+import os
from flask import render_template, request, redirect, flash, url_for, abort
from flask_babel import lazy_gettext, gettext
@@ -241,6 +242,8 @@ def delete_release(package, id):
db.session.delete(release)
db.session.commit()
+ os.remove(release.file_path)
+
return redirect(package.get_url("packages.view"))
diff --git a/app/blueprints/packages/screenshots.py b/app/blueprints/packages/screenshots.py
index 7bc5832e..06878b81 100644
--- a/app/blueprints/packages/screenshots.py
+++ b/app/blueprints/packages/screenshots.py
@@ -13,6 +13,7 @@
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see .
+import os
from flask import render_template, request, redirect, flash, url_for, abort
from flask_babel import lazy_gettext, gettext
@@ -143,4 +144,6 @@ def delete_screenshot(package, id):
db.session.delete(screenshot)
db.session.commit()
+ os.remove(screenshot.file_path)
+
return redirect(package.get_url("packages.screenshots"))