diff --git a/lib/imageRouter/filesystem.js b/lib/imageRouter/filesystem.js index 1f9f52181..76dd92dcf 100644 --- a/lib/imageRouter/filesystem.js +++ b/lib/imageRouter/filesystem.js @@ -22,8 +22,8 @@ function randomFilename () { */ function pickFilename (defaultFilename) { let retryCounter = 5 - let filename = randomFilename() const extname = path.extname(defaultFilename) + let filename = `${randomFilename()}${extname}` while (retryCounter-- > 0) { if (fs.existsSync(path.join(config.uploadsPath, filename))) { filename = `${randomFilename()}${extname}`