From c4e96366bf545430a91f8d271f0641957e8f2d67 Mon Sep 17 00:00:00 2001 From: Max Date: Fri, 1 Nov 2024 12:47:03 +0800 Subject: [PATCH] Use url.QueryUnescape for xpath and method in process components --- widgets/chart/process.go | 5 +++-- widgets/dashboard/process.go | 5 +++-- widgets/list/api.go | 2 +- widgets/list/list.go | 2 +- widgets/list/process.go | 8 ++++---- widgets/table/process.go | 4 ++-- 6 files changed, 14 insertions(+), 12 deletions(-) diff --git a/widgets/chart/process.go b/widgets/chart/process.go index aaec9dc63..c89d2cdbb 100644 --- a/widgets/chart/process.go +++ b/widgets/chart/process.go @@ -2,6 +2,7 @@ package chart import ( "fmt" + "net/url" "github.com/yaoapp/gou/process" "github.com/yaoapp/kun/exception" @@ -33,8 +34,8 @@ func processComponent(process *process.Process) interface{} { process.ValidateArgNums(3) chart := MustGet(process) - xpath := process.ArgsString(1) - method := process.ArgsString(2) + xpath, _ := url.QueryUnescape(process.ArgsString(1)) + method, _ := url.QueryUnescape(process.ArgsString(2)) key := fmt.Sprintf("%s.$%s", xpath, method) // get cloud props diff --git a/widgets/dashboard/process.go b/widgets/dashboard/process.go index a85fc521f..cb999c4ce 100644 --- a/widgets/dashboard/process.go +++ b/widgets/dashboard/process.go @@ -2,6 +2,7 @@ package dashboard import ( "fmt" + "net/url" "github.com/yaoapp/gou/process" "github.com/yaoapp/kun/exception" @@ -33,8 +34,8 @@ func processComponent(process *process.Process) interface{} { process.ValidateArgNums(3) dashboard := MustGet(process) - xpath := process.ArgsString(1) - method := process.ArgsString(2) + xpath, _ := url.QueryUnescape(process.ArgsString(1)) + method, _ := url.QueryUnescape(process.ArgsString(2)) key := fmt.Sprintf("%s.$%s", xpath, method) // get cloud props diff --git a/widgets/list/api.go b/widgets/list/api.go index 706b4d596..ce6a86613 100644 --- a/widgets/list/api.go +++ b/widgets/list/api.go @@ -141,7 +141,7 @@ func exportAPI() error { Path: "/:id/download/:field", Method: "GET", Process: "yao.list.Download", - In: []interface{}{"$param.id", "$param.field", "$query.name", "$query.token"}, + In: []interface{}{"$param.id", "$param.field", "$query.name", "$query.token", "$query.app"}, Out: api.Out{ Status: 200, Body: "{{content}}", diff --git a/widgets/list/list.go b/widgets/list/list.go index e76112e76..7fd059160 100644 --- a/widgets/list/list.go +++ b/widgets/list/list.go @@ -261,7 +261,7 @@ func (dsl *DSL) Xgen(data map[string]interface{}, excludes map[string]bool, quer cProp.Query = newQuery.(map[string]interface{}) } - if cProp.Type == "Upload" { + if cProp.Type == "Upload" || cProp.Type == "WangEditor" { return fmt.Sprintf("/api/__yao/list/%s%s", dsl.ID, cProp.UploadPath()) } diff --git a/widgets/list/process.go b/widgets/list/process.go index 9cd29fc4a..29b99c0e9 100644 --- a/widgets/list/process.go +++ b/widgets/list/process.go @@ -40,8 +40,8 @@ func processComponent(process *gouProcess.Process) interface{} { process.ValidateArgNums(3) list := MustGet(process) - xpath := process.ArgsString(1) - method := process.ArgsString(2) + xpath, _ := url.QueryUnescape(process.ArgsString(1)) + method, _ := url.QueryUnescape(process.ArgsString(2)) key := fmt.Sprintf("%s.$%s", xpath, method) // get cloud props @@ -113,8 +113,8 @@ func processUpload(process *gouProcess.Process) interface{} { process.ValidateArgNums(4) list := MustGet(process) - xpath := process.ArgsString(1) - method := process.ArgsString(2) + xpath, _ := url.QueryUnescape(process.ArgsString(1)) + method, _ := url.QueryUnescape(process.ArgsString(2)) key := fmt.Sprintf("%s.$%s", xpath, method) // get cloud props diff --git a/widgets/table/process.go b/widgets/table/process.go index 444c41e53..ca8f609b4 100644 --- a/widgets/table/process.go +++ b/widgets/table/process.go @@ -151,8 +151,8 @@ func processComponent(process *gouProcess.Process) interface{} { process.ValidateArgNums(3) tab := MustGet(process) - xpath := process.ArgsString(1) - method := process.ArgsString(2) + xpath, _ := url.QueryUnescape(process.ArgsString(1)) + method, _ := url.QueryUnescape(process.ArgsString(2)) key := fmt.Sprintf("%s.$%s", xpath, method) // get cloud props