Web UI: Better handling of upload destination dir checks (#1076)

Web UI: Better handling of upload destination dir checks
This commit is contained in:
Daniel Markstedt 2023-01-26 18:10:33 -08:00 committed by GitHub
parent 538887b805
commit 8823dfba7d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 3 deletions

View File

@ -980,11 +980,14 @@ def upload_file():
return make_response(auth["msg"], 403)
destination = request.form.get("destination")
if destination == "file_server":
destination_dir = FILE_SERVER_DIR
else:
if destination == "disk_images":
server_info = piscsi_cmd.get_server_info()
destination_dir = server_info["image_dir"]
elif destination == "shared_files":
destination_dir = FILE_SERVER_DIR
else:
return make_response(f"Invalid destination '{destination}'", 403)
return upload_with_dropzonejs(destination_dir)

View File

@ -253,6 +253,7 @@ def test_upload_file(http_client, delete_file):
chunk_byte_offset = chunk_number * chunk_size
form_data = {
"destination": "disk_images",
"dzuuid": str(uuid.uuid4()),
"dzchunkindex": chunk_number,
"dzchunksize": chunk_size,