Skip to content

Build your personal knowledge base with Trilium Notes

fix(import/zip): support special characters for attachments

Elian Doran800424405a03
diff --git a/src/services/import/zip.ts b/src/services/import/zip.ts
index 3f7d1ef8e2..aa64251fc6 100644
--- a/src/services/import/zip.ts
+++ b/src/services/import/zip.ts
@@ -1,7 +1,7 @@
"use strict";
import BAttribute from "../../becca/entities/battribute.js";
-import { removeTextFileExtension, newEntityId, getNoteTitle, processStringOrBuffer } from "../../services/utils.js";
+import { removeTextFileExtension, newEntityId, getNoteTitle, processStringOrBuffer, unescapeHtml } from "../../services/utils.js";
import log from "../../services/log.js";
import noteService from "../../services/notes.js";
import attributeService from "../../services/attributes.js";
@@ -109,11 +109,12 @@ async function importZip(taskContext: TaskContext, fileBuffer: Buffer, importRoo
let parent: NoteMeta | undefined = undefined;
- for (const segment of pathSegments) {
+ for (let segment of pathSegments) {
if (!cursor?.children?.length) {
return {};
}
+ segment = unescapeHtml(segment);
parent = cursor;
if (parent.children) {
cursor = parent.children.find((file) => file.dataFileName === segment || file.dirFileName === segment);