Skip to content

Commit bceb7ca

Browse files
committed
🐛 fix: jsonp wrong console.error usage
1 parent d80e888 commit bceb7ca

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

app/controller/api.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -141,16 +141,16 @@ func JsonpHandler(c *gin.Context) {
141141

142142
callback := c.Query("callback")
143143
if callback == "" {
144-
c.String(200, "try{console.error(%s)}catch{}", "missing callback parameter")
144+
c.String(200, "try{console.error('%s')}catch{}", "missing callback parameter")
145145
return
146146
}
147147

148148
u, err := url.Parse(c.GetHeader("Referer"))
149149
if err != nil {
150-
c.String(200, "try{console.error(%s)}catch{}", "unable to parse referer")
150+
c.String(200, "try{console.error('%s')}catch{}", "unable to parse referer")
151151
return
152152
} else if u.Host == "" {
153-
c.String(200, "try{console.error(%s)}catch{}", "invalid referer")
153+
c.String(200, "try{console.error('%s')}catch{}", "invalid referer")
154154
return
155155
}
156156

@@ -166,7 +166,7 @@ func JsonpHandler(c *gin.Context) {
166166
}
167167
jsonData, err := json.Marshal(data)
168168
if err != nil {
169-
c.String(200, "try{console.error(%s)}catch{}", "gen json failed")
169+
c.String(200, "try{console.error('%s')}catch{}", "gen json failed")
170170
return
171171
}
172172

0 commit comments

Comments
 (0)