mirror of
https://github.com/minetest/contentdb.git
synced 2024-12-22 22:12:24 +01:00
Delete release and screenshot uploads immediately
This commit is contained in:
parent
9ff7567cde
commit
6bb6a7ae05
@ -15,6 +15,7 @@
|
|||||||
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
import math
|
import math
|
||||||
|
import os
|
||||||
from functools import wraps
|
from functools import wraps
|
||||||
from typing import List
|
from typing import List
|
||||||
|
|
||||||
@ -343,6 +344,8 @@ def delete_release(token: APIToken, package: Package, id: int):
|
|||||||
db.session.delete(release)
|
db.session.delete(release)
|
||||||
db.session.commit()
|
db.session.commit()
|
||||||
|
|
||||||
|
os.remove(release.file_path)
|
||||||
|
|
||||||
return jsonify({"success": True})
|
return jsonify({"success": True})
|
||||||
|
|
||||||
|
|
||||||
@ -414,6 +417,8 @@ def delete_screenshot(token: APIToken, package: Package, id: int):
|
|||||||
db.session.delete(ss)
|
db.session.delete(ss)
|
||||||
db.session.commit()
|
db.session.commit()
|
||||||
|
|
||||||
|
os.remove(ss.file_path)
|
||||||
|
|
||||||
return jsonify({ "success": True })
|
return jsonify({ "success": True })
|
||||||
|
|
||||||
|
|
||||||
|
@ -13,6 +13,7 @@
|
|||||||
#
|
#
|
||||||
# You should have received a copy of the GNU Affero General Public License
|
# You should have received a copy of the GNU Affero General Public License
|
||||||
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
import os
|
||||||
|
|
||||||
from flask import render_template, request, redirect, flash, url_for, abort
|
from flask import render_template, request, redirect, flash, url_for, abort
|
||||||
from flask_babel import lazy_gettext, gettext
|
from flask_babel import lazy_gettext, gettext
|
||||||
@ -241,6 +242,8 @@ def delete_release(package, id):
|
|||||||
db.session.delete(release)
|
db.session.delete(release)
|
||||||
db.session.commit()
|
db.session.commit()
|
||||||
|
|
||||||
|
os.remove(release.file_path)
|
||||||
|
|
||||||
return redirect(package.get_url("packages.view"))
|
return redirect(package.get_url("packages.view"))
|
||||||
|
|
||||||
|
|
||||||
|
@ -13,6 +13,7 @@
|
|||||||
#
|
#
|
||||||
# You should have received a copy of the GNU Affero General Public License
|
# You should have received a copy of the GNU Affero General Public License
|
||||||
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
import os
|
||||||
|
|
||||||
from flask import render_template, request, redirect, flash, url_for, abort
|
from flask import render_template, request, redirect, flash, url_for, abort
|
||||||
from flask_babel import lazy_gettext, gettext
|
from flask_babel import lazy_gettext, gettext
|
||||||
@ -143,4 +144,6 @@ def delete_screenshot(package, id):
|
|||||||
db.session.delete(screenshot)
|
db.session.delete(screenshot)
|
||||||
db.session.commit()
|
db.session.commit()
|
||||||
|
|
||||||
|
os.remove(screenshot.file_path)
|
||||||
|
|
||||||
return redirect(package.get_url("packages.screenshots"))
|
return redirect(package.get_url("packages.screenshots"))
|
||||||
|
Loading…
Reference in New Issue
Block a user