forked from TrueCloudLab/distribution
Merge pull request #2704 from dmcgowan/fix-2703
Fix registry stripping newlines from manifests
This commit is contained in:
commit
15de837aa8
3 changed files with 9 additions and 12 deletions
|
@ -2,7 +2,6 @@ package storage
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"encoding/json"
|
|
||||||
"fmt"
|
"fmt"
|
||||||
|
|
||||||
"github.com/docker/distribution"
|
"github.com/docker/distribution"
|
||||||
|
@ -23,12 +22,12 @@ var _ ManifestHandler = &manifestListHandler{}
|
||||||
func (ms *manifestListHandler) Unmarshal(ctx context.Context, dgst digest.Digest, content []byte) (distribution.Manifest, error) {
|
func (ms *manifestListHandler) Unmarshal(ctx context.Context, dgst digest.Digest, content []byte) (distribution.Manifest, error) {
|
||||||
dcontext.GetLogger(ms.ctx).Debug("(*manifestListHandler).Unmarshal")
|
dcontext.GetLogger(ms.ctx).Debug("(*manifestListHandler).Unmarshal")
|
||||||
|
|
||||||
var m manifestlist.DeserializedManifestList
|
m := &manifestlist.DeserializedManifestList{}
|
||||||
if err := json.Unmarshal(content, &m); err != nil {
|
if err := m.UnmarshalJSON(content); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
return &m, nil
|
return m, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (ms *manifestListHandler) Put(ctx context.Context, manifestList distribution.Manifest, skipDependencyVerification bool) (digest.Digest, error) {
|
func (ms *manifestListHandler) Put(ctx context.Context, manifestList distribution.Manifest, skipDependencyVerification bool) (digest.Digest, error) {
|
||||||
|
|
|
@ -2,7 +2,6 @@ package storage
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"encoding/json"
|
|
||||||
"fmt"
|
"fmt"
|
||||||
"net/url"
|
"net/url"
|
||||||
|
|
||||||
|
@ -26,12 +25,12 @@ var _ ManifestHandler = &ocischemaManifestHandler{}
|
||||||
func (ms *ocischemaManifestHandler) Unmarshal(ctx context.Context, dgst digest.Digest, content []byte) (distribution.Manifest, error) {
|
func (ms *ocischemaManifestHandler) Unmarshal(ctx context.Context, dgst digest.Digest, content []byte) (distribution.Manifest, error) {
|
||||||
dcontext.GetLogger(ms.ctx).Debug("(*ocischemaManifestHandler).Unmarshal")
|
dcontext.GetLogger(ms.ctx).Debug("(*ocischemaManifestHandler).Unmarshal")
|
||||||
|
|
||||||
var m ocischema.DeserializedManifest
|
m := &ocischema.DeserializedManifest{}
|
||||||
if err := json.Unmarshal(content, &m); err != nil {
|
if err := m.UnmarshalJSON(content); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
return &m, nil
|
return m, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (ms *ocischemaManifestHandler) Put(ctx context.Context, manifest distribution.Manifest, skipDependencyVerification bool) (digest.Digest, error) {
|
func (ms *ocischemaManifestHandler) Put(ctx context.Context, manifest distribution.Manifest, skipDependencyVerification bool) (digest.Digest, error) {
|
||||||
|
|
|
@ -2,7 +2,6 @@ package storage
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"encoding/json"
|
|
||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
"net/url"
|
"net/url"
|
||||||
|
@ -33,12 +32,12 @@ var _ ManifestHandler = &schema2ManifestHandler{}
|
||||||
func (ms *schema2ManifestHandler) Unmarshal(ctx context.Context, dgst digest.Digest, content []byte) (distribution.Manifest, error) {
|
func (ms *schema2ManifestHandler) Unmarshal(ctx context.Context, dgst digest.Digest, content []byte) (distribution.Manifest, error) {
|
||||||
dcontext.GetLogger(ms.ctx).Debug("(*schema2ManifestHandler).Unmarshal")
|
dcontext.GetLogger(ms.ctx).Debug("(*schema2ManifestHandler).Unmarshal")
|
||||||
|
|
||||||
var m schema2.DeserializedManifest
|
m := &schema2.DeserializedManifest{}
|
||||||
if err := json.Unmarshal(content, &m); err != nil {
|
if err := m.UnmarshalJSON(content); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
return &m, nil
|
return m, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (ms *schema2ManifestHandler) Put(ctx context.Context, manifest distribution.Manifest, skipDependencyVerification bool) (digest.Digest, error) {
|
func (ms *schema2ManifestHandler) Put(ctx context.Context, manifest distribution.Manifest, skipDependencyVerification bool) (digest.Digest, error) {
|
||||||
|
|
Loading…
Reference in a new issue