Fix error page (#144)

Co-authored-by: crapStone <crapstone01@gmail.com>
Reviewed-on: https://codeberg.org/Codeberg/pages-server/pulls/144
Reviewed-by: 6543 <6543@obermui.de>
Co-authored-by: crapStone <crapstone@noreply.codeberg.org>
Co-committed-by: crapStone <crapstone@noreply.codeberg.org>
This commit is contained in:
crapStone 2022-12-02 15:25:25 +00:00 committed by 6543
parent 5e72753e91
commit dcf03fc078

View File

@ -1,6 +1,7 @@
package html
import (
"html/template"
"net/http"
"strconv"
"strings"
@ -39,7 +40,8 @@ func errorMessage(statusCode int) string {
// TODO: use template engine
func errorBody(statusCode int) string {
return strings.ReplaceAll(NotFoundPage,
"%status%",
strconv.Itoa(statusCode)+" "+errorMessage(statusCode))
return template.HTMLEscapeString(
strings.ReplaceAll(NotFoundPage,
"%status%",
strconv.Itoa(statusCode)+" "+errorMessage(statusCode)))
}