MCPcopy Create free account
hub / github.com/MCSManager/MCSManager / getExistingUploadNames

Function getExistingUploadNames

frontend/src/hooks/useFileManager.ts:553–589  ·  view source on GitHub ↗
(files: SelectedUploadFile[], targetPath: string)

Source from the content-addressed store, hash-verified

551 };
552
553 const getExistingUploadNames = async (files: SelectedUploadFile[], targetPath: string) => {
554 const targetNames = new Set(files.map((item) => item.file.name));
555 const existingNames = new Set<string>();
556 if (targetNames.size === 0) return existingNames;
557
558 const { execute } = getFileListApi();
559 const pageSize = 100;
560 let page = 0;
561 let total = 0;
562
563 do {
564 const res = await execute({
565 params: {
566 daemonId: daemonId || "",
567 uuid: instanceId || "",
568 page,
569 page_size: pageSize,
570 file_name: "",
571 target: targetPath
572 }
573 });
574
575 const items = res.value?.items || [];
576 total = res.value?.total || 0;
577
578 for (const item of items) {
579 if (!targetNames.has(item.name)) continue;
580 existingNames.add(item.name);
581 targetNames.delete(item.name);
582 }
583
584 page += 1;
585 if (targetNames.size === 0 || items.length === 0) break;
586 } while (page * pageSize < total);
587
588 return existingNames;
589 };
590
591 const countRemainingUploadConflicts = (
592 files: SelectedUploadFile[],

Callers 2

selectedFilesFunction · 0.85
handleFolderUploadFunction · 0.85

Calls 3

executeFunction · 0.85
addMethod · 0.80
deleteMethod · 0.65

Tested by

no test coverage detected