disable schema1 by default, add a config flag to enable it
port of #2473 Signed-off-by: Viktor Stanchev <me@viktorstanchev.com>
This commit is contained in:
parent
f411848591
commit
e9864ce8b9
15 changed files with 103 additions and 14 deletions
23
registry/storage/v1unsupportedhandler.go
Normal file
23
registry/storage/v1unsupportedhandler.go
Normal file
|
@ -0,0 +1,23 @@
|
|||
package storage
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/docker/distribution"
|
||||
digest "github.com/opencontainers/go-digest"
|
||||
)
|
||||
|
||||
// signedManifestHandler is a ManifestHandler that unmarshals v1 manifests but
|
||||
// refuses to Put v1 manifests
|
||||
type v1UnsupportedHandler struct {
|
||||
innerHandler ManifestHandler
|
||||
}
|
||||
|
||||
var _ ManifestHandler = &v1UnsupportedHandler{}
|
||||
|
||||
func (v *v1UnsupportedHandler) Unmarshal(ctx context.Context, dgst digest.Digest, content []byte) (distribution.Manifest, error) {
|
||||
return v.innerHandler.Unmarshal(ctx, dgst, content)
|
||||
}
|
||||
func (v *v1UnsupportedHandler) Put(ctx context.Context, manifest distribution.Manifest, skipDependencyVerification bool) (digest.Digest, error) {
|
||||
return digest.Digest(""), distribution.ErrSchemaV1Unsupported
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue