code.gitea.io/gitea@v1.22.3/routers/utils/utils.go (about)

     1  // Copyright 2017 The Gitea Authors. All rights reserved.
     2  // SPDX-License-Identifier: MIT
     3  
     4  package utils
     5  
     6  import (
     7  	"html"
     8  	"strings"
     9  )
    10  
    11  // SanitizeFlashErrorString will sanitize a flash error string
    12  func SanitizeFlashErrorString(x string) string {
    13  	return strings.ReplaceAll(html.EscapeString(x), "\n", "<br>")
    14  }