mirror of
https://github.com/thomiceli/opengist.git
synced 2024-12-22 20:42:40 +00:00
Fix new line literal in embed (#237)
This commit is contained in:
parent
1c1e3a8919
commit
c185cb8933
1 changed files with 3 additions and 2 deletions
|
@ -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…
Reference in a new issue