Fix backup zip download cleanup

This commit is contained in:
2026-04-26 12:57:21 +02:00
parent 43fdd7081c
commit d3c58c5dd2
+5 -7
View File
@@ -9,7 +9,6 @@ import sqlite3
from flask import (
Blueprint,
after_this_request,
current_app,
flash,
g,
@@ -3710,18 +3709,17 @@ def backup_export():
current_app.config["APP_VERSION"],
)
@after_this_request
def cleanup_backup(response):
Path(archive_path).unlink(missing_ok=True)
return response
return send_file(
archive_size = Path(archive_path).stat().st_size
response = send_file(
archive_path,
as_attachment=True,
download_name=download_name,
mimetype="application/zip",
max_age=0,
)
response.content_length = archive_size
response.call_on_close(lambda: Path(archive_path).unlink(missing_ok=True))
return response
@main_bp.post("/settings/backup/restore")