working commit

This commit is contained in:
2026-02-05 18:03:42 +02:00
parent fcd7d50d75
commit f3d0572bca
5 changed files with 6 additions and 39 deletions
-13
View File
@@ -42,13 +42,10 @@ func (oper *Operator) ManifestExists(ctx context.Context, params *ManifestExists
return res, http.StatusBadRequest, err
}
oper.logg.Debugf("Head manifest [%s:%s]", params.Name, params.Reference)
var manifest descr.Manifest
var exists bool
if stringLikeSHA256Digest(params.Reference) {
digest := fmt.Sprintf("%s:%s", sha256prefix, params.Reference)
oper.logg.Debugf("Find manifest %s by digest %s", params.Name, params.Reference)
exists, manifest, err = oper.mdb.GetManifestByDigest(ctx, params.Name, digest)
if err != nil {
return res, http.StatusInternalServerError, err
@@ -57,7 +54,6 @@ func (oper *Operator) ManifestExists(ctx context.Context, params *ManifestExists
return res, http.StatusNotFound, err
}
} else {
oper.logg.Debugf("Find manifest %s by reference %s", params.Name, params.Reference)
exists, manifest, err = oper.mdb.GetManifestByReference(ctx, params.Name, params.Reference)
if err != nil {
return res, http.StatusInternalServerError, err
@@ -93,8 +89,6 @@ func (oper *Operator) PutManifest(ctx context.Context, params *PutManifestParams
var err error
res := &PutManifestResult{}
//oper.logg.Debugf("Put manifest %s:%s", params.Name, params.Reference)
if params.Reference == "" {
err = fmt.Errorf("Empty reference")
return res, http.StatusBadRequest, err
@@ -140,8 +134,6 @@ func (oper *Operator) PutManifest(ctx context.Context, params *PutManifestParams
code := http.StatusRequestEntityTooLarge
return res, code, err
}
//oper.logg.Debugf("Manifest data: [%s]", string(incomingManifestBytes))
incomingManifest, err := auxoci.ParseOCIManifest(incomingManifestBytes)
if err != nil {
err = fmt.Errorf("Parsing OCI manifest error: %v", err)
@@ -213,7 +205,6 @@ func (oper *Operator) PutManifest(ctx context.Context, params *PutManifestParams
return res, http.StatusInternalServerError, err
}
if exists && blobUsage == 0 {
oper.logg.Debugf("Delete file %s:%s blob %s", name, reference, blob.Digest)
err = oper.store.DeleteBlob(blob.Digest)
if err != nil {
return res, http.StatusInternalServerError, err
@@ -242,8 +233,6 @@ func (oper *Operator) GetManifest(ctx context.Context, params *GetManifestParams
var err error
res := &GetManifestResult{}
//oper.logg.Debugf("Get manifest %s:%s", params.Name, params.Reference)
if params.Name == "" {
err = fmt.Errorf("Empty name")
return res, http.StatusBadRequest, err
@@ -257,7 +246,6 @@ func (oper *Operator) GetManifest(ctx context.Context, params *GetManifestParams
var exists bool
if stringLikeSHADigest(params.Reference) {
digest := normalizeSHADigest(params.Reference)
oper.logg.Debugf("Get manifest %s with digest %s", params.Name, params.Reference)
exists, manifestDescr, err = oper.mdb.GetManifestByDigest(ctx, params.Name, digest)
if err != nil {
return res, http.StatusInternalServerError, err
@@ -266,7 +254,6 @@ func (oper *Operator) GetManifest(ctx context.Context, params *GetManifestParams
return res, http.StatusNotFound, err
}
} else {
oper.logg.Debugf("Get manifest %s with tag %s", params.Name, params.Reference)
exists, manifestDescr, err = oper.mdb.GetManifestByReference(ctx, params.Name, params.Reference)
if err != nil {
return res, http.StatusInternalServerError, err