From 7690ca7c05c86a74e01e90a8c22b46b14fe9baea Mon Sep 17 00:00:00 2001 From: Liang Ding Date: Tue, 3 Jan 2023 23:10:28 +0800 Subject: [PATCH] =?UTF-8?q?:bug:=20=E6=90=9C=E7=B4=A2=E6=8C=87=E5=AE=9A?= =?UTF-8?q?=E8=B7=AF=E5=BE=84=E5=8F=82=E6=95=B0=E8=A7=A3=E6=9E=90=E5=BC=82?= =?UTF-8?q?=E5=B8=B8=20Fix=20https://github.com/siyuan-note/siyuan/issues/?= =?UTF-8?q?6983?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- kernel/api/search.go | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/kernel/api/search.go b/kernel/api/search.go index a55b86438..6fdaeedc6 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)