mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-17 23:20:13 +01:00
🎨 内核 API 校验 ID 格式 Fix https://github.com/siyuan-note/siyuan/issues/7228
This commit is contained in:
parent
b321185248
commit
f37678a98b
8 changed files with 98 additions and 0 deletions
|
|
@ -17,6 +17,7 @@
|
|||
package util
|
||||
|
||||
import (
|
||||
"github.com/88250/lute/ast"
|
||||
"github.com/imroc/req/v3"
|
||||
"github.com/siyuan-note/httpclient"
|
||||
"net/http"
|
||||
|
|
@ -65,6 +66,16 @@ func JsonArg(c *gin.Context, result *gulu.Result) (arg map[string]interface{}, o
|
|||
return
|
||||
}
|
||||
|
||||
func InvalidIDPattern(idArg string, result *gulu.Result) bool {
|
||||
if ast.IsNodeIDPattern(idArg) {
|
||||
return false
|
||||
}
|
||||
|
||||
result.Code = -1
|
||||
result.Msg = "invalid ID argument"
|
||||
return true
|
||||
}
|
||||
|
||||
func initHttpClient() {
|
||||
http.DefaultClient = httpclient.GetCloudFileClient2Min()
|
||||
http.DefaultTransport = httpclient.NewTransport(false)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue