Fix: Problem with \r\n and Blackfriday

main
Óscar M. Lage 2022-03-23 00:25:18 +01:00
parent edf05b8e7c
commit e4fafed6fa
1 changed files with 2 additions and 1 deletions

View File

@ -26,7 +26,8 @@ func WikiPage(c echo.Context) error {
}
}
fmt.Printf("res: %T\n", page)
unsafe := blackfriday.Run([]byte(page.Body))
body := strings.ReplaceAll(page.Body, "\r\n", "\n")
unsafe := blackfriday.Run([]byte(body))
html := bluemonday.UGCPolicy().SanitizeBytes(unsafe)
return c.Render(http.StatusOK, "page.html", map[string]interface{}{
"page": page,