From 19be157411d90c4027df4fb2fd50eb196c4a47ae Mon Sep 17 00:00:00 2001 From: superlishunqin <852326703@qq.com> Date: Wed, 2 Apr 2025 21:47:17 +0800 Subject: [PATCH] fix_bug_download-multiple_file --- routes/classify.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/routes/classify.py b/routes/classify.py index 09d38a6..c81a243 100644 --- a/routes/classify.py +++ b/routes/classify.py @@ -5,7 +5,7 @@ import uuid import zipfile import rarfile import shutil -from flask import Blueprint, request, jsonify, current_app, send_file, g, session +from flask import Blueprint, request, jsonify, current_app, send_file, g, session, after_this_request from werkzeug.utils import secure_filename import mysql.connector from utils.model_service import text_classifier # Assuming text_classifier is initialized correctly elsewhere @@ -634,7 +634,7 @@ def download_multiple_documents(): logger.info(f"用户 {user_id} 请求下载 {files_added} 个文档打包为 {zip_filename}") # Use after_this_request to delete the temp file after sending - @current_app.after_request + @after_this_request def remove_file(response): try: if zip_path and os.path.exists(zip_path):