Skip to content

Commit

Permalink
Merge pull request #2704 from dmcgowan/fix-2703
Browse files Browse the repository at this point in the history
Fix registry stripping newlines from manifests
  • Loading branch information
dmcgowan authored Sep 6, 2018
2 parents efa4c3b + c88728f commit 15de837
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 12 deletions.
7 changes: 3 additions & 4 deletions registry/storage/manifestlisthandler.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package storage

import (
"context"
"encoding/json"
"fmt"

"github.com/docker/distribution"
Expand All @@ -23,12 +22,12 @@ var _ ManifestHandler = &manifestListHandler{}
func (ms *manifestListHandler) Unmarshal(ctx context.Context, dgst digest.Digest, content []byte) (distribution.Manifest, error) {
dcontext.GetLogger(ms.ctx).Debug("(*manifestListHandler).Unmarshal")

var m manifestlist.DeserializedManifestList
if err := json.Unmarshal(content, &m); err != nil {
m := &manifestlist.DeserializedManifestList{}
if err := m.UnmarshalJSON(content); err != nil {
return nil, err
}

return &m, nil
return m, nil
}

func (ms *manifestListHandler) Put(ctx context.Context, manifestList distribution.Manifest, skipDependencyVerification bool) (digest.Digest, error) {
Expand Down
7 changes: 3 additions & 4 deletions registry/storage/ocimanifesthandler.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package storage

import (
"context"
"encoding/json"
"fmt"
"net/url"

Expand All @@ -26,12 +25,12 @@ var _ ManifestHandler = &ocischemaManifestHandler{}
func (ms *ocischemaManifestHandler) Unmarshal(ctx context.Context, dgst digest.Digest, content []byte) (distribution.Manifest, error) {
dcontext.GetLogger(ms.ctx).Debug("(*ocischemaManifestHandler).Unmarshal")

var m ocischema.DeserializedManifest
if err := json.Unmarshal(content, &m); err != nil {
m := &ocischema.DeserializedManifest{}
if err := m.UnmarshalJSON(content); err != nil {
return nil, err
}

return &m, nil
return m, nil
}

func (ms *ocischemaManifestHandler) Put(ctx context.Context, manifest distribution.Manifest, skipDependencyVerification bool) (digest.Digest, error) {
Expand Down
7 changes: 3 additions & 4 deletions registry/storage/schema2manifesthandler.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package storage

import (
"context"
"encoding/json"
"errors"
"fmt"
"net/url"
Expand Down Expand Up @@ -33,12 +32,12 @@ var _ ManifestHandler = &schema2ManifestHandler{}
func (ms *schema2ManifestHandler) Unmarshal(ctx context.Context, dgst digest.Digest, content []byte) (distribution.Manifest, error) {
dcontext.GetLogger(ms.ctx).Debug("(*schema2ManifestHandler).Unmarshal")

var m schema2.DeserializedManifest
if err := json.Unmarshal(content, &m); err != nil {
m := &schema2.DeserializedManifest{}
if err := m.UnmarshalJSON(content); err != nil {
return nil, err
}

return &m, nil
return m, nil
}

func (ms *schema2ManifestHandler) Put(ctx context.Context, manifest distribution.Manifest, skipDependencyVerification bool) (digest.Digest, error) {
Expand Down

0 comments on commit 15de837

Please sign in to comment.