Clean up tmp file before attempting to upload again

This commit is contained in:
Daniel Markstedt 2023-11-11 15:17:27 +09:00
parent b5ec4e7f9c
commit 7a197d6754
1 changed files with 4 additions and 0 deletions

View File

@ -1066,6 +1066,10 @@ def upload_file():
if path.exists(save_path) and current_chunk == 0:
return make_response(_("The file already exists!"), 400)
if path.exists(tmp_save_path) and current_chunk == 0:
log.info("Temporary file found; deleting before downloading again...")
file_cmd.delete_file(tmp_save_path)
try:
with open(tmp_save_path, "ab") as save:
save.seek(int(request.form["dzchunkbyteoffset"]))