From fe79bf173b5b3d47344dff36aad925123c0f6135 Mon Sep 17 00:00:00 2001 From: Arash Date: Mon, 14 Oct 2024 17:26:21 +0200 Subject: [PATCH] Refactor file upload handling in LibraryActions to check payload.upload_files before assign it --- lib/galaxy/actions/library.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/galaxy/actions/library.py b/lib/galaxy/actions/library.py index 8a62c2470691..8afb8d4f2275 100644 --- a/lib/galaxy/actions/library.py +++ b/lib/galaxy/actions/library.py @@ -125,8 +125,9 @@ def _upload_dataset(self, trans, folder_id: int, payload): raise exceptions.InvalidFileFormatError("Invalid folder specified") # Proceed with (mostly) regular upload processing if we're still errorless if payload.upload_option == "upload_file": - for i, upload_dataset in enumerate(tool_params["files"]): - upload_dataset["file_data"] = payload.upload_files[i] + if payload.upload_files: + for i, upload_dataset in enumerate(tool_params["files"]): + upload_dataset["file_data"] = payload.upload_files[i] tool_params = upload_common.persist_uploads(tool_params, trans) uploaded_datasets = upload_common.get_uploaded_datasets( trans, cntrller, tool_params, dataset_upload_inputs, library_bunch=library_bunch