Skip to content

Build your personal knowledge base with Trilium Notes

server: Add comment to clarify use of regex

Elian Doranc2baa4b752e4
diff --git a/src/services/export/zip.ts b/src/services/export/zip.ts
index 5e30e62974..75feeebc6a 100644
--- a/src/services/export/zip.ts
+++ b/src/services/export/zip.ts
@@ -61,6 +61,7 @@ async function exportToZip(taskContext: TaskContext, branch: BBranch, format: "h
// Crop fileName to avoid its length exceeding 30 and prevent cutting into the extension.
if (fileName.length > 30) {
+ // We use regex to match the extension to preserve multiple dots in extensions (e.g. .tar.gz).
let match = fileName.match(/(\.[a-zA-Z0-9_.!#-]+)$/);
let ext = match ? match[0] : '';
// Crop the extension if extension length exceeds 30