Skip to content

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

:bug: 搜索指定路径参数解析异常 Fix https://github.com/siyuan-note/siyuan/issues/6983

Liang Ding7690ca7c05c8
diff --git a/kernel/api/search.go b/kernel/api/search.go
index a55b864381..6fdaeedc67 100644
--- a/kernel/api/search.go
+++ b/kernel/api/search.go
@@ -201,10 +201,14 @@ func fullTextSearchBlock(c *gin.Context) {
if nil != pathsArg {
for _, p := range pathsArg.([]interface{}) {
path := p.(string)
- box := strings.Split(path, "/")[0]
- boxes = append(boxes, box)
- path = strings.TrimPrefix(path, box)
- paths = append(paths, path)
+ box := strings.TrimSpace(strings.Split(path, "/")[0])
+ if "" != box {
+ boxes = append(boxes, box)
+ }
+ path = strings.TrimSpace(strings.TrimPrefix(path, box))
+ if "" != path {
+ paths = append(paths, path)
+ }
}
paths = gulu.Str.RemoveDuplicatedElem(paths)
boxes = gulu.Str.RemoveDuplicatedElem(boxes)