From e4fafed6fa336108f6e72ded393d25b59db1e053 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?O=CC=81scar=20M=2E=20Lage?= Date: Wed, 23 Mar 2022 00:25:18 +0100 Subject: [PATCH] Fix: Problem with \r\n and Blackfriday --- server/app.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/server/app.go b/server/app.go index 2492558..ee463d6 100644 --- a/server/app.go +++ b/server/app.go @@ -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,