From bceb7ca2aa87cc9cb87ac88c7607656117c54444 Mon Sep 17 00:00:00 2001 From: soxft Date: Wed, 4 Dec 2024 11:14:55 +0800 Subject: [PATCH] :bug: fix: jsonp wrong console.error usage --- app/controller/api.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/app/controller/api.go b/app/controller/api.go index a4d7e0c..0f0148b 100644 --- a/app/controller/api.go +++ b/app/controller/api.go @@ -141,16 +141,16 @@ func JsonpHandler(c *gin.Context) { callback := c.Query("callback") if callback == "" { - c.String(200, "try{console.error(%s)}catch{}", "missing callback parameter") + c.String(200, "try{console.error('%s')}catch{}", "missing callback parameter") return } u, err := url.Parse(c.GetHeader("Referer")) if err != nil { - c.String(200, "try{console.error(%s)}catch{}", "unable to parse referer") + c.String(200, "try{console.error('%s')}catch{}", "unable to parse referer") return } else if u.Host == "" { - c.String(200, "try{console.error(%s)}catch{}", "invalid referer") + c.String(200, "try{console.error('%s')}catch{}", "invalid referer") return } @@ -166,7 +166,7 @@ func JsonpHandler(c *gin.Context) { } jsonData, err := json.Marshal(data) if err != nil { - c.String(200, "try{console.error(%s)}catch{}", "gen json failed") + c.String(200, "try{console.error('%s')}catch{}", "gen json failed") return }