fix(registry): ignore empty challenge fields (#1626)

Co-authored-by: caotian <caotian@users.noreply.github.com>
This commit is contained in:
nils måsén 2023-04-12 08:18:00 +02:00 committed by GitHub
parent 9d6b008b4b
commit 4d661bf63b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 18 additions and 6 deletions

View file

@ -123,10 +123,9 @@ func GetAuthURL(challenge string, img string) (*url.URL, error) {
for _, pair := range pairs {
trimmed := strings.Trim(pair, " ")
kv := strings.Split(trimmed, "=")
key := kv[0]
val := strings.Trim(kv[1], "\"")
values[key] = val
if key, val, ok := strings.Cut(trimmed, "="); ok {
values[key] = strings.Trim(val, `"`)
}
}
logrus.WithFields(logrus.Fields{
"realm": values["realm"],