From 7e04c3311d1db349ce2497046007f1f3ed931d82 Mon Sep 17 00:00:00 2001 From: Daniel <845765@qq.com> Date: Sun, 24 Nov 2024 10:52:22 +0800 Subject: [PATCH] :art: Improve importing Markdown https://github.com/siyuan-note/siyuan/issues/13245 --- kernel/model/import.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/kernel/model/import.go b/kernel/model/import.go index e0c4dde34..2fe6d2038 100644 --- a/kernel/model/import.go +++ b/kernel/model/import.go @@ -740,7 +740,7 @@ func ImportFromLocalPath(boxID, localPath string, toPath string) (err error) { curRelPath := filepath.ToSlash(strings.TrimPrefix(currentPath, localPath)) targetPath := path.Join(baseTargetPath, id) - hPath := path.Join(baseHPath, filepath.ToSlash(strings.TrimPrefix(currentPath, localPath))) + hPath := path.Join(baseHPath, filepath.Base(localPath), filepath.ToSlash(strings.TrimPrefix(currentPath, localPath))) hPath = strings.TrimSuffix(hPath, ext) if "" == curRelPath { curRelPath = "/" @@ -798,7 +798,7 @@ func ImportFromLocalPath(boxID, localPath string, toPath string) (err error) { if "" != yfmTitle { title = yfmTitle } - unescapedTitle, unescapeErr := url.QueryUnescape(title) + unescapedTitle, unescapeErr := url.PathUnescape(title) if nil == unescapeErr { title = unescapedTitle } @@ -920,7 +920,7 @@ func ImportFromLocalPath(boxID, localPath string, toPath string) (err error) { if "" != yfmTitle { title = yfmTitle } - unescapedTitle, unescapeErr := url.QueryUnescape(title) + unescapedTitle, unescapeErr := url.PathUnescape(title) if nil == unescapeErr { title = unescapedTitle }