mirror of
https://github.com/thomiceli/opengist.git
synced 2025-05-14 00:02:10 +02:00
Fix new line literal in embed (#237)
This commit is contained in:
parent
1c1e3a8919
commit
c185cb8933
@ -443,8 +443,9 @@ func gistJs(ctx echo.Context) error {
|
||||
js := `document.write('<link rel="stylesheet" href="%s">')
|
||||
document.write('%s')
|
||||
`
|
||||
js = fmt.Sprintf(js, cssUrl,
|
||||
strings.Replace(htmlbuf.String(), "\n", `\n`, -1))
|
||||
content := strings.Replace(htmlbuf.String(), `\n`, `\\n`, -1)
|
||||
content = strings.Replace(content, "\n", `\n`, -1)
|
||||
js = fmt.Sprintf(js, cssUrl, content)
|
||||
ctx.Response().Header().Set("Content-Type", "application/javascript")
|
||||
return plainText(ctx, 200, js)
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user