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
-12
View File
@@ -23,7 +23,6 @@ type BlobExistsResult struct {
func (oper *Operator) BlobExists(ctx context.Context, params *BlobExistsParams) (*BlobExistsResult, int, error) {
var err error
res := &BlobExistsResult{}
//oper.logg.Debugf("Calling BlobExists")
if params.Digest == "" {
err = fmt.Errorf("Empty reference")
@@ -80,8 +79,6 @@ func (oper *Operator) PostUpload(ctx context.Context, params *PostUploadParams)
var err error
res := &PostUploadResult{}
//oper.logg.Debugf("Calling PostUpload")
if params.Digest == "" {
uuid := auxuuid.NewUUID()
location := fmt.Sprintf("/v2/%s/blobs/uploads/%s", params.Name, uuid)
@@ -118,8 +115,6 @@ func (oper *Operator) PatchUpload(ctx context.Context, params *PatchUploadParams
var err error
res := &PatchUploadResult{}
//oper.logg.Debugf("Calling PatchUpload")
if params.Reference == "" {
err = fmt.Errorf("Empty reference")
return res, http.StatusBadRequest, err
@@ -185,8 +180,6 @@ func (oper *Operator) PutUpload(ctx context.Context, params *PutUploadParams) (*
var err error
res := &PutUploadResult{}
//oper.logg.Debugf("Calling PutUpload")
if params.Reference == "" {
err = fmt.Errorf("Empty reference")
return res, http.StatusBadRequest, err
@@ -244,8 +237,6 @@ func (oper *Operator) GetBlob(ctx context.Context, params *GetBlobParams) (*GetB
var err error
res := &GetBlobResult{}
//oper.logg.Debugf("Calling GetBlob %s:%s", params.Name, params.Digest)
if params.Name == "" {
err = fmt.Errorf("Empty name")
return res, http.StatusBadRequest, err
@@ -260,7 +251,6 @@ func (oper *Operator) GetBlob(ctx context.Context, params *GetBlobParams) (*GetB
return res, http.StatusInternalServerError, err
}
if !blobExists {
oper.logg.Debugf("Blob %s:%s not exists", params.Name, params.Digest)
return res, http.StatusNotFound, err
}
@@ -285,8 +275,6 @@ func (oper *Operator) DeleteBlob(ctx context.Context, params *DeleteBlobParams)
var err error
res := &DeleteBlobResult{}
//oper.logg.Debugf("Calling DeleteBlob")
if params.Digest == "" {
err = fmt.Errorf("Empty digest")
return res, http.StatusBadRequest, err
+1 -8
View File
@@ -101,8 +101,6 @@ func (oper *Operator) PutFile(ctx context.Context, param *PutFileParams) (int, *
filename := path.Base(xfilepath)
collection := path.Dir(xfilepath)
oper.logg.Debugf("Put file [%s] [%s]", collection, filename)
tmpname, size, checksum, err := oper.store.WriteTempFile(param.Source)
if err != nil {
code := http.StatusInternalServerError
@@ -178,8 +176,6 @@ func (oper *Operator) GetFile(ctx context.Context, param *GetFileParams) (int, *
filename := path.Base(xfilepath)
collection := path.Dir(xfilepath)
oper.logg.Debugf("Get file [%s] [%s]", collection, filename)
descrExists, fileDescr, err := oper.mdb.GetFileByCollection(ctx, collection, filename)
if err != nil {
code := http.StatusInternalServerError
@@ -259,14 +255,11 @@ func (oper *Operator) ListFiles(ctx context.Context, param *ListFilesParams) (in
// TODO: convert file path to a unified and secure state
xfilepath, err := cleanFilepath(param.Filepath)
_, err = cleanFilepath(param.Filepath)
if err != nil {
code := http.StatusInternalServerError
return code, res, err
}
collection := xfilepath
oper.logg.Debugf("List files by %s", collection)
fileDescrs, err := oper.mdb.ListAllFiles(ctx)
if err != nil {
-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
-1
View File
@@ -12,6 +12,5 @@ func (oper *Operator) GetVersion(ctx context.Context, params *GetVersionParams)
var err error
code := http.StatusOK
res := &GetVersionResult{}
oper.logg.Debugf("Call GetVersion")
return res, code, err
}