Only redact the URL password if it was provided

This commit is contained in:
Tim Hockin 2023-10-11 09:04:24 -07:00
parent bb1dc0b7a5
commit fc5e065878
1 changed files with 3 additions and 1 deletions

View File

@ -1274,7 +1274,9 @@ func redactURL(urlstr string) string {
return err.Error()
}
if u.User != nil {
u.User = url.UserPassword(u.User.Username(), redactedString)
if _, found := u.User.Password(); found {
u.User = url.UserPassword(u.User.Username(), redactedString)
}
}
return u.String()
}