Skip to content

Commit

Permalink
Delete leftover temporary audio files. Fixes #224, #225, #226
Browse files Browse the repository at this point in the history
  • Loading branch information
mbi committed Dec 19, 2023
1 parent 835f985 commit bf7fffc
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGES
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ Version History
Version 0.6.1 (unreleased)
--------------------------
* Fixed docs and test configuration
* Delete leftover temporary audio files (#224, #225, #226 thanks @dawidratynski and @A-dead-pixel)


Version 0.6.0
Expand Down
4 changes: 2 additions & 2 deletions captcha/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -201,11 +201,11 @@ def captcha_audio(request, key):
if os.path.isfile(path):
# Move the response file to a filelike that will be deleted on close
temporary_file = tempfile.TemporaryFile()
with open(path,'rb') as original_file:
with open(path, "rb") as original_file:
temporary_file.write(original_file.read())
temporary_file.seek(0)
os.remove(path)

response = RangedFileResponse(
request, temporary_file, content_type="audio/wav"
)
Expand Down

0 comments on commit bf7fffc

Please sign in to comment.