fix_bug_download-multiple_file
This commit is contained in:
parent
c989258444
commit
19be157411
@ -5,7 +5,7 @@ import uuid
|
|||||||
import zipfile
|
import zipfile
|
||||||
import rarfile
|
import rarfile
|
||||||
import shutil
|
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
|
from werkzeug.utils import secure_filename
|
||||||
import mysql.connector
|
import mysql.connector
|
||||||
from utils.model_service import text_classifier # Assuming text_classifier is initialized correctly elsewhere
|
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}")
|
logger.info(f"用户 {user_id} 请求下载 {files_added} 个文档打包为 {zip_filename}")
|
||||||
# Use after_this_request to delete the temp file after sending
|
# Use after_this_request to delete the temp file after sending
|
||||||
@current_app.after_request
|
@after_this_request
|
||||||
def remove_file(response):
|
def remove_file(response):
|
||||||
try:
|
try:
|
||||||
if zip_path and os.path.exists(zip_path):
|
if zip_path and os.path.exists(zip_path):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user