1
0
mirror of https://github.com/astaxie/beego.git synced 2024-11-22 18:30:56 +00:00
This commit is contained in:
astaxie 2013-11-08 18:00:07 +08:00
parent 2a81595c3e
commit 91c7635d0e

View File

@ -8,6 +8,7 @@ import (
"encoding/xml" "encoding/xml"
"errors" "errors"
"fmt" "fmt"
"html/template"
"io" "io"
"mime" "mime"
"net/http" "net/http"
@ -157,7 +158,7 @@ func (output *BeegoOutput) Jsonp(data interface{}, hasIndent bool) error {
if callback == "" { if callback == "" {
return errors.New(`"callback" parameter required`) return errors.New(`"callback" parameter required`)
} }
callback_content := bytes.NewBufferString(callback) callback_content := bytes.NewBufferString(template.JSEscapeString(callback))
callback_content.WriteString("(") callback_content.WriteString("(")
callback_content.Write(content) callback_content.Write(content)
callback_content.WriteString(");\r\n") callback_content.WriteString(");\r\n")