Skip to content

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

:bug: Fix insertBlock API argument check https://ld246.com/article/1711525429788

Daniel92c72694bb00
diff --git a/kernel/api/block_op.go b/kernel/api/block_op.go
index 0839d21293..051e03ae5a 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
+ }
}
}