From 5014a921a4d00f87b5c89aebc973489eccc7a17d Mon Sep 17 00:00:00 2001 From: Liang Ding Date: Mon, 17 Apr 2023 12:18:28 +0800 Subject: [PATCH] :art: Check the validity of the API `moveBlock` parameter `previousID` Fix https://github.com/siyuan-note/siyuan/issues/8007 --- kernel/api/block_op.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/kernel/api/block_op.go b/kernel/api/block_op.go index f5df3a91d..3e70a740e 100644 --- a/kernel/api/block_op.go +++ b/kernel/api/block_op.go @@ -55,6 +55,13 @@ func moveBlock(c *gin.Context) { if util.InvalidIDPattern(previousID, ret) { return } + + // Check the validity of the API `moveBlock` parameter `previousID` https://github.com/siyuan-note/siyuan/issues/8007 + if bt := treenode.GetBlockTree(previousID); nil == bt || "d" == bt.Type { + ret.Code = -1 + ret.Msg = "`previousID` can not be the ID of a document" + return + } } transactions := []*model.Transaction{