return existing file for already uploaded case

This commit is contained in:
Abhinav 2022-09-01 18:53:06 +05:30
parent 45a2f5056f
commit e821ee726c

View file

@ -68,7 +68,14 @@ export default async function uploader(
addLogLine( addLogLine(
`file already present in the collection , skipped upload for ${fileNameSize}` `file already present in the collection , skipped upload for ${fileNameSize}`
); );
return { fileUploadResult: UPLOAD_RESULT.ALREADY_UPLOADED }; const sameCollectionMatchingExistingFile =
matchingExistingFiles.find(
(f) => f.collectionID === collection.id
);
return {
fileUploadResult: UPLOAD_RESULT.ALREADY_UPLOADED,
uploadedFile: sameCollectionMatchingExistingFile,
};
} else { } else {
addLogLine( addLogLine(
`same file in ${matchingExistingFilesCollectionIDs.length} collection found for ${fileNameSize}` `same file in ${matchingExistingFilesCollectionIDs.length} collection found for ${fileNameSize}`