Skip to content

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

:bug: Database filtering for specific dates not working Fix https://github.com/siyuan-note/siyuan/issues/10518

Danielf61a6131fe45
diff --git a/kernel/av/av.go b/kernel/av/av.go
index a695a97369..95adc4e3c9 100644
--- a/kernel/av/av.go
+++ b/kernel/av/av.go
@@ -24,6 +24,7 @@ import (
"path/filepath"
"regexp"
"strconv"
+ "strings"
"time"
"github.com/88250/gulu"
@@ -231,8 +232,17 @@ func ParseAttributeView(avID string) (ret *AttributeView, err error) {
ret = &AttributeView{}
if err = gulu.JSON.UnmarshalJSON(data, ret); nil != err {
- logging.LogErrorf("unmarshal attribute view [%s] failed: %s", avID, err)
- return
+ if strings.Contains(err.Error(), "cannot unmarshal string into Go struct field ValueRelation.keyValues.values.relation.contents of type av.Value") {
+ // v3.0.3 兼容之前旧版本,通过正则将 "relation":{"contents":[".*"],"blockIDs": 替换为 "relation":{"contents":null,"blockIDs":
+ data = regexp.MustCompile(`"relation":{"contents":\[".*"\],"blockIDs":`).ReplaceAll(data, []byte(`"relation":{"contents":null,"blockIDs":`))
+ if err = gulu.JSON.UnmarshalJSON(data, ret); nil != err {
+ logging.LogErrorf("unmarshal attribute view [%s] failed: %s", avID, err)
+ return
+ }
+ } else {
+ logging.LogErrorf("unmarshal attribute view [%s] failed: %s", avID, err)
+ return
+ }
}
return
}
@@ -340,7 +350,7 @@ func SaveAttributeView(av *AttributeView) (err error) {
// 补全过滤器 Value
for _, view := range av.Views {
- if nil == view.Table {
+ if nil != view.Table {
for _, f := range view.Table.Filters {
if nil != f.Value {
continue