|
@@ -219,7 +219,7 @@ def archive_download(archive_name):
|
|
|
break
|
|
break
|
|
|
yield chunk
|
|
yield chunk
|
|
|
finally:
|
|
finally:
|
|
|
- subprocess.run(["sudo", "rm", "-f", tmp_path], capture_output=True)
|
|
|
|
|
|
|
+ subprocess.run(["sudo", "rm", "-rf", tmp_path], capture_output=True)
|
|
|
|
|
|
|
|
return Response(
|
|
return Response(
|
|
|
stream_with_context(_stream()),
|
|
stream_with_context(_stream()),
|
|
@@ -234,11 +234,9 @@ def archive_download(archive_name):
|
|
|
|
|
|
|
|
@bp.route("/archives/<path:archive_name>/delete", methods=["POST"])
|
|
@bp.route("/archives/<path:archive_name>/delete", methods=["POST"])
|
|
|
def archive_delete(archive_name):
|
|
def archive_delete(archive_name):
|
|
|
- import os, subprocess
|
|
|
|
|
|
|
+ from jobs.utils import sudo_rm_archive
|
|
|
backup_dir = current_app.config["YUNOHOST_BACKUP_DIR"]
|
|
backup_dir = current_app.config["YUNOHOST_BACKUP_DIR"]
|
|
|
- tar_path = os.path.join(backup_dir, archive_name + ".tar")
|
|
|
|
|
- info_path = os.path.join(backup_dir, archive_name + ".info.json")
|
|
|
|
|
- subprocess.run(["sudo", "rm", "-f", tar_path, info_path], capture_output=True)
|
|
|
|
|
|
|
+ sudo_rm_archive(archive_name, backup_dir)
|
|
|
flash(f"Archive « {archive_name} » supprimée.", "success")
|
|
flash(f"Archive « {archive_name} » supprimée.", "success")
|
|
|
return redirect(url_for("jobs.archives"))
|
|
return redirect(url_for("jobs.archives"))
|
|
|
|
|
|