working commit
This commit is contained in:
+10
-1
@@ -19,6 +19,7 @@ import (
|
||||
"net/http"
|
||||
"strconv"
|
||||
|
||||
ocidigest "github.com/opencontainers/go-digest"
|
||||
ocispec "github.com/opencontainers/image-spec/specs-go/v1"
|
||||
)
|
||||
|
||||
@@ -74,6 +75,14 @@ func (oper *Operator) PutManifest(ctx context.Context, params *PutManifestParams
|
||||
return res, http.StatusInternalServerError, err
|
||||
}
|
||||
inManData := buffer.Bytes()
|
||||
var digstr string
|
||||
digobj, parseErr := ocidigest.Parse(params.Reference)
|
||||
if parseErr == nil {
|
||||
digstr = digobj.String()
|
||||
} else {
|
||||
digobj := ocidigest.FromBytes(inManData)
|
||||
digstr = digobj.String()
|
||||
}
|
||||
if int64(len(inManData)) != contentLength {
|
||||
err = fmt.Errorf("Mismatch Content-Length and received manifest size: %d vs %d",
|
||||
contentLength, len(inManData))
|
||||
@@ -112,6 +121,7 @@ func (oper *Operator) PutManifest(ctx context.Context, params *PutManifestParams
|
||||
}
|
||||
|
||||
inManDescr, inlayerdescrs, err := descrsFromManifest(name, reference, inMan, inManData)
|
||||
inManDescr.Digest = digstr
|
||||
// Always check layer files for availability
|
||||
var blobError error
|
||||
for _, blobDescr := range inlayerdescrs {
|
||||
@@ -178,7 +188,6 @@ func (oper *Operator) PutManifest(ctx context.Context, params *PutManifestParams
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for _, blobDescr := range inlayerdescrs {
|
||||
// TODO: move the requests to db layer transaction
|
||||
blobDescrExists, _, err := oper.mdb.GetBlobByNameDigest(ctx, blobDescr.Name, blobDescr.Digest)
|
||||
|
||||
Reference in New Issue
Block a user