Skip to content

Build your personal knowledge base with Trilium Notes

Get file extension before clipping file name (#2562)

Mirwaisse Djanbaz64172a7f6baf
diff --git a/src/services/export/zip.js b/src/services/export/zip.js
index 3e8e3ad4a5..1cdface651 100644
--- a/src/services/export/zip.js
+++ b/src/services/export/zip.js
@@ -52,13 +52,13 @@ function exportToZip(taskContext, branch, format, res) {
function getDataFileName(note, baseFileName, existingFileNames) {
let fileName = baseFileName;
+ let existingExtension = path.extname(fileName).toLowerCase();
+ let newExtension;
+
if (fileName.length > 30) {
fileName = fileName.substr(0, 30);
}
- let existingExtension = path.extname(fileName).toLowerCase();
- let newExtension;
-
// following two are handled specifically since we always want to have these extensions no matter the automatic detection
// and/or existing detected extensions in the note name
if (note.type === 'text' && format === 'markdown') {