Skip to content

Commit

Permalink
fix: Don't call shouldReplaceFile if no existing file
Browse files Browse the repository at this point in the history
  • Loading branch information
Crash-- authored and doubleface committed Dec 11, 2023
1 parent 578ab95 commit ee07f33
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion packages/cozy-clisk/src/launcher/saveFiles.js
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,11 @@ const saveFiles = async (client, entries, folderPath, options) => {
const existingFile = options.existingFilesIndex.get(
calculateFileKey(entry, options.fileIdAttributes)
)
const shouldReplace = shouldReplaceFile(existingFile, entry, saveOptions)
let shouldReplace = false
if (existingFile) {
shouldReplace = shouldReplaceFile(existingFile, entry, saveOptions)
}

if (!existingFile || shouldReplace) {
toSaveEntries.push({ ...entry, existingFile, shouldReplace })
} else {
Expand Down

0 comments on commit ee07f33

Please sign in to comment.