Skip to content

Commit

Permalink
prevent deletion the temp file
Browse files Browse the repository at this point in the history
  • Loading branch information
sumn2u committed Jun 21, 2024
1 parent 822a1f2 commit f76e28d
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions server/app.py
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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:
Expand Down

0 comments on commit f76e28d

Please sign in to comment.