🐛 导入 Markdown 文件夹后无法在其中继续导入 https://github.com/siyuan-note/siyuan/issues/7512

This commit is contained in:
Liang Ding 2023-02-28 17:43:54 +08:00
parent e772e97b72
commit 7074aacacc
No known key found for this signature in database
GPG key ID: 136F30F901A2231D
2 changed files with 6 additions and 4 deletions

View file

@ -509,8 +509,11 @@ 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 = strings.TrimSuffix(hPath, ext)
if "" == curRelPath {
curRelPath = "/"
hPath = "/" + title
} else {
dirPath := targetPaths[path.Dir(curRelPath)]
targetPath = path.Join(dirPath, id)
@ -519,8 +522,7 @@ func ImportFromLocalPath(boxID, localPath string, toPath string) (err error) {
targetPath = strings.ReplaceAll(targetPath, ".sy/", "/")
targetPath += ".sy"
targetPaths[curRelPath] = targetPath
hPath := path.Join(baseHPath, filepath.ToSlash(strings.TrimPrefix(currentPath, localPath)))
hPath = strings.TrimSuffix(hPath, ext)
if info.IsDir() {
tree = treenode.NewTree(boxID, targetPath, hPath, title)
if err = indexWriteJSONQueue(tree); nil != err {