Ignore auth header with empty JSON object

Signed-off-by: Alessandro Verzicco <152161683+alessandro-verzicco@users.noreply.github.com>
This commit is contained in:
Alessandro Verzicco
2025-11-06 17:29:58 +01:00
parent 94c4951537
commit ac58beed26
2 changed files with 5 additions and 0 deletions

View File

@@ -336,6 +336,9 @@ func parseMultiAuthHeader(authHeader string) (map[string]types.DockerAuthConfig,
// Now convert to the internal types.
authConfigs := make(map[string]types.DockerAuthConfig)
if len(dockerAuthConfigs) == 0 {
return nil, nil
}
for server := range dockerAuthConfigs {
authConfigs[server] = dockerAuthToImageAuth(dockerAuthConfigs[server])
}

View File

@@ -392,6 +392,8 @@ func TestParseMultiAuthHeader(t *testing.T) {
}{
// Empty header
{input: "", expected: nil},
// Empty JSON object {}=e30= base64-encoded
{input: "e30=", expected: nil},
// "null"
{input: "null", expected: nil},
// Invalid JSON