v0.0.2: split api_bp into upload/process/download modules, Connection: close, upload tests (13 new, 106 total)
Deploy drhider / validate (push) Waiting to run
Deploy drhider / validate (push) Waiting to run
This commit is contained in:
@@ -0,0 +1,21 @@
|
||||
"""
|
||||
GET /api/download/{sid} — скачать ZIP и удалить сессию.
|
||||
|
||||
После этого вызова — всё чисто, памяти ноль.
|
||||
"""
|
||||
|
||||
import io
|
||||
from flask import Blueprint, send_file, jsonify
|
||||
from session import get_result, cleanup
|
||||
|
||||
download_bp = Blueprint("download", __name__, url_prefix="/api")
|
||||
|
||||
|
||||
@download_bp.route("/download/<sid>", methods=["GET"])
|
||||
def download(sid):
|
||||
zip_data = get_result(sid)
|
||||
if zip_data is None:
|
||||
return jsonify({"ok": False, "error": "Not found"}), 404
|
||||
cleanup(sid)
|
||||
return send_file(io.BytesIO(zip_data), mimetype="application/zip",
|
||||
as_attachment=True, download_name="drhider_output.zip")
|
||||
Reference in New Issue
Block a user