Forráskód Böngészése

:art: 无法添加题头图标签 https://github.com/siyuan-note/siyuan/issues/6756

Liang Ding 2 éve
szülő
commit
0428d050d0
2 módosított fájl, 5 hozzáadás és 0 törlés
  1. 3 0
      kernel/api/search.go
  2. 2 0
      kernel/model/tag.go

+ 3 - 0
kernel/api/search.go

@@ -83,6 +83,9 @@ func searchTag(c *gin.Context) {
 
 	k := arg["k"].(string)
 	tags := model.SearchTags(k)
+	if 1 > len(tags) {
+		tags = []string{}
+	}
 	ret.Data = map[string]interface{}{
 		"tags": tags,
 		"k":    k,

+ 2 - 0
kernel/model/tag.go

@@ -20,6 +20,7 @@ import (
 	"bytes"
 	"errors"
 	"fmt"
+	"github.com/siyuan-note/logging"
 	"sort"
 	"strings"
 
@@ -282,6 +283,7 @@ func sortTags(tags Tags) {
 
 func SearchTags(keyword string) (ret []string) {
 	ret = []string{}
+	defer logging.Recover() // TODO: 定位 无法添加题头图标签 https://github.com/siyuan-note/siyuan/issues/6756
 
 	labels := labelBlocksByKeyword(keyword)
 	for label, _ := range labels {