Skip to content

Commit f667ce8

Browse files
authored
Merge pull request #20456 from ahmedhamidawan/fix_remote_file_upload_in_collection
[25.0] Fix multiple remote file upload to collection creator
2 parents 1241ab4 + e18910f commit f667ce8

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

client/src/components/Collections/ListCollectionCreator.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -333,7 +333,7 @@ function addUploadedFiles(files: HDASummary[]) {
333333
localize(`Dataset ${f.hid}: ${f.name} ${problem} and is an invalid element for this collection`),
334334
localize("Uploaded item is invalid")
335335
);
336-
} else {
336+
} else if (!file) {
337337
invalidElements.value.push("Uploaded item: " + f.name + " could not be added to the collection");
338338
Toast.error(
339339
localize(`Dataset ${f.hid}: ${f.name} could not be added to the collection`),

client/src/composables/monitorUploadedHistoryItems.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,16 @@ export function monitorUploadedHistoryItems(
3737
const uploadedDatasets: HistoryItemSummary[] = [];
3838
uploadValues.value.forEach((model) => {
3939
const outputs = model.outputs;
40+
// Some uploads (e.g.: in the case of remote file upload) may have the entire set of uploaded files
41+
// in the `outputs` object, while typically, the `outputs` object contains each individual upload.
4042
if (outputs) {
4143
Object.entries(outputs).forEach((output) => {
4244
const outputDetails = output[1] as HistoryItemSummary;
43-
uploadedDatasets.push(outputDetails);
45+
// Since there is a possibility of all uploads being in the `outputs` object,
46+
// we need to ensure that we only add unique datasets to the list.
47+
if (!uploadedDatasets.some((item) => item.id === outputDetails.id)) {
48+
uploadedDatasets.push(outputDetails);
49+
}
4450
});
4551
}
4652
});

0 commit comments

Comments
 (0)