Unverified Commit f667ce8d authored by Marius van den Beek's avatar Marius van den Beek Committed by GitHub
Browse files

Merge pull request #20456 from ahmedhamidawan/fix_remote_file_upload_in_collection

[25.0] Fix multiple remote file upload to collection creator
parents 1241ab44 e18910f1
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -333,7 +333,7 @@ function addUploadedFiles(files: HDASummary[]) {
                localize(`Dataset ${f.hid}: ${f.name} ${problem} and is an invalid element for this collection`),
                localize("Uploaded item is invalid")
            );
        } else {
        } else if (!file) {
            invalidElements.value.push("Uploaded item: " + f.name + " could not be added to the collection");
            Toast.error(
                localize(`Dataset ${f.hid}: ${f.name} could not be added to the collection`),
+7 −1
Original line number Diff line number Diff line
@@ -37,10 +37,16 @@ export function monitorUploadedHistoryItems(
        const uploadedDatasets: HistoryItemSummary[] = [];
        uploadValues.value.forEach((model) => {
            const outputs = model.outputs;
            // Some uploads (e.g.: in the case of remote file upload) may have the entire set of uploaded files
            // in the `outputs` object, while typically, the `outputs` object contains each individual upload.
            if (outputs) {
                Object.entries(outputs).forEach((output) => {
                    const outputDetails = output[1] as HistoryItemSummary;
                    // Since there is a possibility of all uploads being in the `outputs` object,
                    // we need to ensure that we only add unique datasets to the list.
                    if (!uploadedDatasets.some((item) => item.id === outputDetails.id)) {
                        uploadedDatasets.push(outputDetails);
                    }
                });
            }
        });