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

This commit is contained in:
Elian Doran 2025-03-16 14:39:17 +02:00
parent 132a8f7c65
commit 800424405a
No known key found for this signature in database

View File

@ -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);