Skip to content

An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作

:bug: 导入包含 `.` 的 Markdown 文件夹问题 Fix https://github.com/siyuan-note/siyuan/issues/5148

Liang Ding2ca33753e0e7
diff --git a/kernel/model/import.go b/kernel/model/import.go
index fa875265ce..61f3919bb0 100644
--- a/kernel/model/import.go
+++ b/kernel/model/import.go
@@ -407,9 +407,12 @@ func ImportFromLocalPath(boxID, localPath string, toPath string) (err error) {
}
var tree *parse.Tree
-
- ext := path.Ext(info.Name())
- title := strings.TrimSuffix(info.Name(), ext)
+ var ext string
+ title := info.Name()
+ if !info.IsDir() {
+ ext = path.Ext(info.Name())
+ title = strings.TrimSuffix(info.Name(), ext)
+ }
id := ast.NewNodeID()
curRelPath := filepath.ToSlash(strings.TrimPrefix(currentPath, localPath))