diff options
author | Frederick Muriuki Muriithi | 2025-01-21 11:40:59 -0600 |
---|---|---|
committer | Frederick Muriuki Muriithi | 2025-01-21 11:40:59 -0600 |
commit | 959f90e1490847165f2185b373799c2cbd772d1f (patch) | |
tree | 355aff6a0fd2dea4a7e43454b31083203c0dffe4 /uploader/files | |
parent | 40c671185952209ca33b95222d519be3207be3ab (diff) | |
download | gn-uploader-959f90e1490847165f2185b373799c2cbd772d1f.tar.gz |
Add "original-name" and "uploaded-file" to all successful responses.
Since both the original file name, and the final computed file name
could (and do) find use after the upload has completed, include them
in all the success messages.
Diffstat (limited to 'uploader/files')
-rw-r--r-- | uploader/files/views.py | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/uploader/files/views.py b/uploader/files/views.py index 10d52d4..8d81654 100644 --- a/uploader/files/views.py +++ b/uploader/files/views.py @@ -27,8 +27,11 @@ def resumable_upload_get(): }), 400 # If the complete target file exists, return 200 for all chunks. - if target_file(fileid).exists(): + _targetfile = target_file(fileid) + if _targetfile.exists(): return jsonify({ + "uploaded-file": _targetfile.name, + "original-name": filename, "chunk": chunk, "message": "The complete file already exists.", "statuscode": 200 @@ -74,6 +77,7 @@ def resumable_upload_post(): if _targetfile.exists(): return jsonify({ "uploaded-file": _targetfile.name, + "original-name": _uploadfilename, "message": "File was uploaded successfully!", "statuscode": 200 }), 200 @@ -93,6 +97,7 @@ def resumable_upload_post(): chunks_directory(_fileid).rmdir() return jsonify({ "uploaded-file": _targetfile.name, + "original-name": _uploadfilename, "message": "File was uploaded successfully!", "statuscode": 200 }), 200 |