mirror of
https://github.com/TriliumNext/Notes.git
synced 2025-07-27 10:02:59 +08:00
fix(import/zip): regression in normal import
This commit is contained in:
parent
02a0624e8f
commit
24c82fa7b6
@ -262,13 +262,13 @@ async function importZip(taskContext: TaskContext, fileBuffer: Buffer, importRoo
|
|||||||
}
|
}
|
||||||
|
|
||||||
function getEntityIdFromRelativeUrl(url: string, filePath: string) {
|
function getEntityIdFromRelativeUrl(url: string, filePath: string) {
|
||||||
let absUrl;
|
let absUrl: string;
|
||||||
if (!url.startsWith("/")) {
|
if (!url.startsWith("/")) {
|
||||||
while (url.startsWith("./")) {
|
while (url.startsWith("./")) {
|
||||||
url = url.substr(2);
|
url = url.substr(2);
|
||||||
}
|
}
|
||||||
|
|
||||||
let absUrl = path.dirname(filePath);
|
absUrl = path.dirname(filePath);
|
||||||
|
|
||||||
while (url.startsWith("../")) {
|
while (url.startsWith("../")) {
|
||||||
absUrl = path.dirname(absUrl);
|
absUrl = path.dirname(absUrl);
|
||||||
@ -285,6 +285,8 @@ async function importZip(taskContext: TaskContext, fileBuffer: Buffer, importRoo
|
|||||||
absUrl = topLevelPath + url;
|
absUrl = topLevelPath + url;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
console.log(url, "-->", absUrl);
|
||||||
|
|
||||||
const { noteMeta, attachmentMeta } = getMeta(absUrl);
|
const { noteMeta, attachmentMeta } = getMeta(absUrl);
|
||||||
|
|
||||||
if (attachmentMeta && attachmentMeta.attachmentId && noteMeta.noteId) {
|
if (attachmentMeta && attachmentMeta.attachmentId && noteMeta.noteId) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user