Skip to content

Commit

Permalink
🐛 close temp_zip file
Browse files Browse the repository at this point in the history
  • Loading branch information
PitButtchereit committed May 26, 2024
1 parent 77a4ed9 commit 3643fc6
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions tracex_project/tracex/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -139,9 +139,9 @@ def zip_files_response(files_to_download):
file_name = os.path.basename(file_path)
zipf.write(file_path, arcname=file_name)

temp_zip.close()

response = FileResponse(open(temp_zip.name, "rb"), as_attachment=True)
response["Content-Disposition"] = 'attachment; filename="downloaded_files.zip"'

os.remove(temp_zip.name)

return response

0 comments on commit 3643fc6

Please sign in to comment.