Merge remote-tracking branch 'origin/dev' into dev

This commit is contained in:
Vanessa 2023-04-17 12:49:10 +08:00
commit 1cc838950a
2 changed files with 14 additions and 7 deletions

View file

@ -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{

View file

@ -308,14 +308,14 @@ func lsNotebooks(c *gin.Context) {
ret := gulu.Ret.NewResult()
defer c.JSON(http.StatusOK, ret)
arg, ok := util.JsonArg(c, ret)
if !ok {
return
}
flashcard := false
if arg["flashcard"] != nil {
flashcard = arg["flashcard"].(bool)
// 兼容旧版接口,不能直接使用 util.JsonArg()
arg := map[string]interface{}{}
if err := c.ShouldBindJSON(&arg); nil == err {
if arg["flashcard"] != nil {
flashcard = arg["flashcard"].(bool)
}
}
var notebooks []*model.Box