From 92c72694bb00658c5354ff6c7574ae4c37b07d5b Mon Sep 17 00:00:00 2001 From: Daniel <845765@qq.com> Date: Wed, 27 Mar 2024 19:58:37 +0800 Subject: [PATCH] :bug: Fix insertBlock API argument check https://ld246.com/article/1711525429788 --- kernel/api/block_op.go | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/kernel/api/block_op.go b/kernel/api/block_op.go index 0839d2129..051e03ae5 100644 --- a/kernel/api/block_op.go +++ b/kernel/api/block_op.go @@ -364,20 +364,26 @@ func insertBlock(c *gin.Context) { var parentID, previousID, nextID string if nil != arg["parentID"] { parentID = arg["parentID"].(string) - if util.InvalidIDPattern(parentID, ret) { - return + if "" != parentID { + if util.InvalidIDPattern(parentID, ret) { + return + } } } if nil != arg["previousID"] { previousID = arg["previousID"].(string) - if util.InvalidIDPattern(previousID, ret) { - return + if "" != previousID { + if util.InvalidIDPattern(previousID, ret) { + return + } } } if nil != arg["nextID"] { nextID = arg["nextID"].(string) - if util.InvalidIDPattern(nextID, ret) { - return + if "" != nextID { + if util.InvalidIDPattern(nextID, ret) { + return + } } }