Revert "api/types/registry: EncodeAuthConfig: use empty string for zero value"

This reverts commit 3a447bc079.

Some daemon versions don't handle empty values well, which resulted in
an io.EOF error when sending an empty X-Registry-Auth during decoding
or unmarshaling.

We should investigate what code-paths are hit to trigger this, but
in the meantime, let's revert this patch.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
Sebastiaan van Stijn
2025-07-31 15:38:41 +02:00
parent 39030fdf94
commit 8b68b977b1
2 changed files with 2 additions and 5 deletions

View File

@@ -52,9 +52,6 @@ type AuthConfig struct {
//
// [RFC4648, section 5]: https://tools.ietf.org/html/rfc4648#section-5
func EncodeAuthConfig(authConfig AuthConfig) (string, error) {
if authConfig == (AuthConfig{}) {
return "", nil
}
buf, err := json.Marshal(authConfig)
if err != nil {
return "", errInvalidParameter{err}

View File

@@ -111,8 +111,8 @@ func TestEncodeAuthConfig(t *testing.T) {
{
doc: "empty",
input: AuthConfig{},
outBase64: ``,
outPlain: ``,
outBase64: `e30=`,
outPlain: `{}`,
},
{
doc: "test authConfig",