api/types/registry: add TODO/note about empty authConfigs

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

View File

@@ -52,6 +52,11 @@ type AuthConfig struct {
//
// [RFC4648, section 5]: https://tools.ietf.org/html/rfc4648#section-5
func EncodeAuthConfig(authConfig AuthConfig) (string, error) {
// Older daemons (or registries) may not handle an empty string,
// which resulted in an "io.EOF" when unmarshaling or decoding.
//
// FIXME(thaJeztah): find exactly what code-paths are impacted by this.
// if authConfig == (AuthConfig{}) { return "", nil }
buf, err := json.Marshal(authConfig)
if err != nil {
return "", errInvalidParameter{err}

View File

@@ -109,6 +109,10 @@ func TestEncodeAuthConfig(t *testing.T) {
outPlain string
}{
{
// Older daemons (or registries) may not handle an empty string,
// which resulted in an "io.EOF" when unmarshaling or decoding.
//
// FIXME(thaJeztah): find exactly what code-paths are impacted by this.
doc: "empty",
input: AuthConfig{},
outBase64: `e30=`,