From c8a6d9db0b66fae357fa1bb5e9ad4bf221177ac0 Mon Sep 17 00:00:00 2001 From: Vanessa Date: Thu, 25 Apr 2024 21:18:52 +0800 Subject: [PATCH] :art: https://github.com/siyuan-note/siyuan/issues/10671 --- app/src/util/newFile.ts | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/app/src/util/newFile.ts b/app/src/util/newFile.ts index f04ef682e..b83e1356f 100644 --- a/app/src/util/newFile.ts +++ b/app/src/util/newFile.ts @@ -164,13 +164,17 @@ export const getSavePath = (pathString: string, notebookId: string, cb: (p: stri fetchPost("/api/filetree/getRefCreateSavePath", { notebook: notebookId }, (data) => { + let targetPath = pathString; + if (notebookId !== data.data.box) { + targetPath = data.data.path || "/"; + } if (data.data.path) { if (data.data.path.startsWith("/")) { cb(getDisplayName(data.data.path, false, true)); } else { fetchPost("/api/filetree/getHPathByPath", { notebook: data.data.box, - path: pathString + path: targetPath }, (response) => { cb(getDisplayName(pathPosix().join(response.data, data.data.path), false, true)); }); @@ -178,7 +182,7 @@ export const getSavePath = (pathString: string, notebookId: string, cb: (p: stri } else { fetchPost("/api/filetree/getHPathByPath", { notebook: data.data.box, - path: pathString + path: targetPath }, (response) => { cb(getDisplayName(response.data, false, true)); });