Skip to content

Commit e371318

Browse files
Fix RedactURL: avoid URL-encoding of *** characters
1 parent 334ade4 commit e371318

1 file changed

Lines changed: 9 additions & 1 deletion

File tree

git/git.go

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -479,7 +479,15 @@ func RedactURL(u string) string {
479479
// Successfully parsed as a URL with a scheme
480480
// Redact userinfo if present (handles user, user:pass, token, URL-encoded creds)
481481
if parsed.User != nil {
482-
parsed.User = url.User("***")
482+
// Build URL manually to avoid url.User encoding *** as %2A%2A%2A
483+
result := parsed.Scheme + "://***@" + parsed.Host + parsed.Path
484+
if parsed.RawQuery != "" {
485+
result += "?" + parsed.RawQuery
486+
}
487+
if parsed.Fragment != "" {
488+
result += "#" + parsed.Fragment
489+
}
490+
return result
483491
}
484492
return parsed.String()
485493
}

0 commit comments

Comments
 (0)