Skip to content

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

:art: Clean code

Danielc7746d13993c
diff --git a/kernel/api/block.go b/kernel/api/block.go
index 02c6cdf4ee..209cff5871 100644
--- a/kernel/api/block.go
+++ b/kernel/api/block.go
@@ -376,7 +376,10 @@ func getRefText(c *gin.Context) {
}
id := arg["id"].(string)
- model.FlushTxQueue()
+ if util.InvalidIDPattern(id, ret) {
+ return
+ }
+
refText := model.GetBlockRefText(id)
if "" == refText {
// 空块返回 id https://github.com/siyuan-note/siyuan/issues/10259
diff --git a/kernel/model/blockinfo.go b/kernel/model/blockinfo.go
index 3152f6dc07..a6b75365c6 100644
--- a/kernel/model/blockinfo.go
+++ b/kernel/model/blockinfo.go
@@ -204,6 +204,8 @@ func GetDocsInfo(blockIDs []string, queryRefCount bool, queryAv bool) (rets []*B
}
func GetBlockRefText(id string) string {
+ FlushTxQueue()
+
bt := treenode.GetBlockTree(id)
if nil == bt {
return ErrBlockNotFound.Error()