Просмотр исходного кода

:art: Improve importing Markdown https://github.com/siyuan-note/siyuan/issues/13245

Daniel 8 месяцев назад
Родитель
Сommit
7e04c3311d
1 измененных файлов с 3 добавлено и 3 удалено
  1. 3 3
      kernel/model/import.go

+ 3 - 3
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
 		}