mirror of
https://github.com/TriliumNext/Notes.git
synced 2025-09-11 05:01:31 +08:00
fix(import/zip): support special characters for attachments
This commit is contained in:
parent
132a8f7c65
commit
800424405a
@ -1,7 +1,7 @@
|
|||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
import BAttribute from "../../becca/entities/battribute.js";
|
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 log from "../../services/log.js";
|
||||||
import noteService from "../../services/notes.js";
|
import noteService from "../../services/notes.js";
|
||||||
import attributeService from "../../services/attributes.js";
|
import attributeService from "../../services/attributes.js";
|
||||||
@ -109,11 +109,12 @@ async function importZip(taskContext: TaskContext, fileBuffer: Buffer, importRoo
|
|||||||
|
|
||||||
let parent: NoteMeta | undefined = undefined;
|
let parent: NoteMeta | undefined = undefined;
|
||||||
|
|
||||||
for (const segment of pathSegments) {
|
for (let segment of pathSegments) {
|
||||||
if (!cursor?.children?.length) {
|
if (!cursor?.children?.length) {
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
segment = unescapeHtml(segment);
|
||||||
parent = cursor;
|
parent = cursor;
|
||||||
if (parent.children) {
|
if (parent.children) {
|
||||||
cursor = parent.children.find((file) => file.dataFileName === segment || file.dirFileName === segment);
|
cursor = parent.children.find((file) => file.dataFileName === segment || file.dirFileName === segment);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user