diff --git a/lib/core/fs.js b/lib/core/fs.js index 2edfd5f3..01a987dc 100644 --- a/lib/core/fs.js +++ b/lib/core/fs.js @@ -120,9 +120,10 @@ function copyPreserve(sourceFilePath, targetFilePath) { let ext = 1; let preserved = targetFilePath; while (fs.existsSync(preserved)) { + let extname = path.extname(targetFilePath); preserved = utils.joinPath( path.dirname(targetFilePath), - `${path.basename(targetFilePath)}.${ext}${path.extname(targetFilePath)}` + `${path.basename(targetFilePath, extname)}.${ext}${extname}` ); ext++; }