mirror of
https://github.com/go-gitea/gitea
synced 2025-07-22 02:08:36 +00:00
Sanitize credentials in mirror form (#9975)
This commit is contained in:
@@ -7,6 +7,8 @@ package util
|
||||
import (
|
||||
"net/url"
|
||||
"strings"
|
||||
|
||||
"code.gitea.io/gitea/modules/log"
|
||||
)
|
||||
|
||||
// urlSafeError wraps an error whose message may contain a sensitive URL
|
||||
@@ -36,6 +38,7 @@ func SanitizeMessage(message, unsanitizedURL string) string {
|
||||
func SanitizeURLCredentials(unsanitizedURL string, usePlaceholder bool) string {
|
||||
u, err := url.Parse(unsanitizedURL)
|
||||
if err != nil {
|
||||
log.Error("parse url %s failed: %v", unsanitizedURL, err)
|
||||
// don't log the error, since it might contain unsanitized URL.
|
||||
return "(unparsable url)"
|
||||
}
|
||||
|
Reference in New Issue
Block a user