working commit

This commit is contained in:
2026-02-04 21:43:26 +02:00
parent 55e8abcdd3
commit 3900d93559
7 changed files with 340 additions and 68 deletions
+4 -4
View File
@@ -97,6 +97,7 @@ func (oper *Operator) PostUpload(ctx context.Context, params *PostUploadParams)
type PatchUploadParams struct {
ContentType string
ContentLength string
ContentRange string
Name string
Reference string
Reader io.Reader
@@ -129,7 +130,8 @@ func (oper *Operator) PatchUpload(ctx context.Context, params *PatchUploadParams
return res, http.StatusBadRequest, err
}
var contentLength int64
// podman & github.com/containers/image don't set Content-length header for docker transport
// Unfortunately, podman & github.com/containers/image don't set Content-length header for docker transport
if params.ContentLength != "" {
contentLength, err = strconv.ParseInt(params.ContentLength, 10, 64)
if err != nil {
@@ -138,7 +140,7 @@ func (oper *Operator) PatchUpload(ctx context.Context, params *PatchUploadParams
}
}
recsize, err := oper.store.WriteUpload(params.Reference, params.Reader)
recsize, _, err := oper.store.WriteUpload(params.Reference, params.Reader)
if err != nil {
return res, http.StatusInternalServerError, err
}
@@ -200,8 +202,6 @@ func (oper *Operator) PutUpload(ctx context.Context, params *PutUploadParams) (*
// TODO
err = fmt.Errorf("Unexpected Content-Length header: %s", params.ContentLength)
return res, http.StatusInternalServerError, err
Content - Range
}
err = oper.store.LinkUpload(params.Reference, params.Digest)