🐛 插入/更新资源文件导致内核崩溃 https://github.com/siyuan-note/siyuan/issues/5574

This commit is contained in:
Liang Ding 2022-08-04 18:08:15 +08:00
parent c0df1e50d4
commit caf2dc5231
No known key found for this signature in database
GPG key ID: 136F30F901A2231D
6 changed files with 19 additions and 16 deletions

View file

@ -167,10 +167,9 @@ func SearchAssetsByName(keyword string) (ret []*cache.Asset) {
ret = []*cache.Asset{}
count := 0
cache.Assets.Range(func(k, v interface{}) bool {
asset := v.(*cache.Asset)
for _, asset := range cache.Assets {
if !strings.Contains(strings.ToLower(asset.HName), strings.ToLower(keyword)) {
return true
continue
}
_, hName := search.MarkText(asset.HName, keyword, 64, Conf.Search.CaseSensitive)
@ -181,10 +180,9 @@ func SearchAssetsByName(keyword string) (ret []*cache.Asset) {
})
count++
if Conf.Search.Limit <= count {
return false
return
}
return true
})
}
sort.Slice(ret, func(i, j int) bool {
return ret[i].Updated > ret[j].Updated