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

This commit is contained in:
Liang Ding 2023-01-03 23:10:28 +08:00
parent 5e1d539719
commit 7690ca7c05
No known key found for this signature in database
GPG Key ID: 136F30F901A2231D

View File

@ -201,10 +201,14 @@ func fullTextSearchBlock(c *gin.Context) {
if nil != pathsArg { if nil != pathsArg {
for _, p := range pathsArg.([]interface{}) { for _, p := range pathsArg.([]interface{}) {
path := p.(string) path := p.(string)
box := strings.Split(path, "/")[0] box := strings.TrimSpace(strings.Split(path, "/")[0])
boxes = append(boxes, box) if "" != box {
path = strings.TrimPrefix(path, box) boxes = append(boxes, box)
paths = append(paths, path) }
path = strings.TrimSpace(strings.TrimPrefix(path, box))
if "" != path {
paths = append(paths, path)
}
} }
paths = gulu.Str.RemoveDuplicatedElem(paths) paths = gulu.Str.RemoveDuplicatedElem(paths)
boxes = gulu.Str.RemoveDuplicatedElem(boxes) boxes = gulu.Str.RemoveDuplicatedElem(boxes)