forked from TrueCloudLab/distribution
e0281dc609
gofumpt (https://github.com/mvdan/gofumpt) provides a supserset of `gofmt` / `go fmt`, and addresses various formatting issues that linters may be checking for. We can consider enabling the `gofumpt` linter to verify the formatting in CI, although not every developer may have it installed, so for now this runs it once to get formatting in shape. Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
24 lines
755 B
Go
24 lines
755 B
Go
package storage
|
|
|
|
import (
|
|
"context"
|
|
|
|
"github.com/distribution/distribution/v3"
|
|
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
|
|
}
|