diff options
author | Frederick Muriuki Muriithi | 2025-01-21 10:41:37 -0600 |
---|---|---|
committer | Frederick Muriuki Muriithi | 2025-01-21 10:41:37 -0600 |
commit | 7ec1495babe6be6f0ac1c89e3b79fc6a703bf369 (patch) | |
tree | 88de7ef7766033d973184aec17c569eb261fc604 /uploader/files | |
parent | 1625218c37df95c84dbcea5a0f049ba5f1285850 (diff) | |
download | gn-uploader-7ec1495babe6be6f0ac1c89e3b79fc6a703bf369.tar.gz |
Extract target file path computation to a utility function.
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 06481ee..7e2ef0b 100644 --- a/uploader/files/views.py +++ b/uploader/files/views.py @@ -8,6 +8,11 @@ from .chunks import chunk_name, chunks_directory files = Blueprint("files", __name__) +def target_file(fileid: str) -> Path: + """Compute the full path for the target file.""" + return Path(app.config["UPLOAD_FOLDER"], fileid) + + @files.route("/upload/resumable", methods=["GET"]) def resumable_upload_get(): """Used for checking whether **ALL** chunks have been uploaded.""" @@ -56,7 +61,7 @@ def resumable_upload_post(): "resumableFilename", default="", type=str) or "" _fileid = request.form.get( "resumableIdentifier", default="", type=str) or "" - _targetfile = Path(app.config["UPLOAD_FOLDER"], _fileid) + _targetfile = target_file(_fileid) if _targetfile.exists(): return jsonify({ |