Skip to content

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

:art: https://github.com/siyuan-note/siyuan/issues/16050

Danielb3a4068ceaa7
diff --git a/kernel/api/filetree.go b/kernel/api/filetree.go
index a8bb81b8af..cd02b1c942 100644
--- a/kernel/api/filetree.go
+++ b/kernel/api/filetree.go
@@ -114,11 +114,11 @@ func listDocTree(c *gin.Context) {
ids := map[string]bool{}
for _, entry := range dir {
- if entry.IsDir() {
- if strings.HasPrefix(entry.Name(), ".") {
- continue
- }
+ if strings.HasPrefix(entry.Name(), ".") {
+ continue
+ }
+ if entry.IsDir() {
if !ast.IsNodeIDPattern(entry.Name()) {
continue
}
@@ -134,7 +134,12 @@ func listDocTree(c *gin.Context) {
return
}
} else {
- doc := &DocFile{ID: strings.TrimSuffix(entry.Name(), ".sy")}
+ id := strings.TrimSuffix(entry.Name(), ".sy")
+ if !ast.IsNodeIDPattern(id) {
+ continue
+ }
+
+ doc := &DocFile{ID: id}
if !ids[doc.ID] {
doctree = append(doctree, doc)
}