Skip to content

Commit c7746d1

Browse files
committed
🎨 Clean code
1 parent 0b5a83d commit c7746d1

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

kernel/api/block.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -376,7 +376,10 @@ func getRefText(c *gin.Context) {
376376
}
377377

378378
id := arg["id"].(string)
379-
model.FlushTxQueue()
379+
if util.InvalidIDPattern(id, ret) {
380+
return
381+
}
382+
380383
refText := model.GetBlockRefText(id)
381384
if "" == refText {
382385
// 空块返回 id https://github.com/siyuan-note/siyuan/issues/10259

kernel/model/blockinfo.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -204,6 +204,8 @@ func GetDocsInfo(blockIDs []string, queryRefCount bool, queryAv bool) (rets []*B
204204
}
205205

206206
func GetBlockRefText(id string) string {
207+
FlushTxQueue()
208+
207209
bt := treenode.GetBlockTree(id)
208210
if nil == bt {
209211
return ErrBlockNotFound.Error()

0 commit comments

Comments
 (0)