From 25443926d3a7cfbc0786de68ab141e062cdbc93a Mon Sep 17 00:00:00 2001 From: Martin Filser Date: Thu, 18 Aug 2022 21:12:33 +0200 Subject: [PATCH] Attachment, path was wrong if the file hasn't a extension --- models/attachments.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/models/attachments.js b/models/attachments.js index 3816a407a..6bd73e4b7 100644 --- a/models/attachments.js +++ b/models/attachments.js @@ -59,7 +59,12 @@ Attachments = new FilesCollection({ delete opts.meta.fileId; } else if (opts?.file?.name) { // Server - filenameWithoutExtension = opts.file.name.replace(new RegExp(opts.file.extensionWithDot + "$"), "") + if (opts.file.extension) { + filenameWithoutExtension = opts.file.name.replace(new RegExp(opts.file.extensionWithDot + "$"), "") + } else { + // file has no extension, so don't replace anything, otherwise the last character is removed (because extensionWithDot = '.') + filenameWithoutExtension = opts.file.name; + } fileId = opts.fileId; } else {