From f76e28df043c0ceef653f256cbb50686d8355a23 Mon Sep 17 00:00:00 2001 From: sumn2u Date: Thu, 20 Jun 2024 23:26:26 -0500 Subject: [PATCH] prevent deletion the temp file --- server/app.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/server/app.py b/server/app.py index dddba13..a8ff8a0 100644 --- a/server/app.py +++ b/server/app.py @@ -1,4 +1,4 @@ -from flask import Flask, jsonify, request, url_for,send_from_directory,send_file, after_this_request +from flask import Flask, jsonify, request, url_for,send_from_directory,send_file from flask_cors import CORS, cross_origin from db.db_handler import Module from io import BytesIO @@ -543,11 +543,11 @@ def download_yolo_annotations(): f.write(annotation + "\n") # Send the file as a downloadable response - @after_this_request - def cleanup(response): - if temp_file and os.path.exists(temp_file): - os.remove(temp_file) - return response + # @after_this_request # Cleanup the temporary file after the response is sent + # def cleanup(response): + # if temp_file and os.path.exists(temp_file): + # os.remove(temp_file) + # return response return send_file(temp_file, as_attachment=True, download_name=temp_file), 200 except ValueError as e: