From 53cdd2bb07ba551229e546c423f1e2c3a6274c5f Mon Sep 17 00:00:00 2001 From: Marco Dickert Date: Tue, 24 Nov 2020 15:57:21 +0100 Subject: [PATCH] Fix correct detection of existing files Signed-off-by: Marco Dickert --- src/ifm.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/ifm.js b/src/ifm.js index 190ff96..1619fb9 100644 --- a/src/ifm.js +++ b/src/ifm.js @@ -951,8 +951,10 @@ function IFM(params) { var existing_files; if (files.length > 1) existing_files = files.map(x => x.name).filter(item => self.fileCache.map(x => x.name).includes(item)); - else - existing_files = self.fileCache.map(x => x.name).indexOf(newfilename) ? [newfilename] : []; + else if (newfilename) + existing_files = self.fileCache.map(x => x.name).indexOf(newfilename) !== -1 ? [newfilename] : []; + else + existing_files = self.fileCache.map(x => x.name).indexOf(files[0].name) !== -1 ? [files[0].name] : []; if (existing_files.length > 0 && self.config.confirmoverwrite) self.showUploadConfirmOverwrite(files, existing_files, newfilename); else {