diff options
Diffstat (limited to 'routers/api/packages/container/container.go')
-rw-r--r-- | routers/api/packages/container/container.go | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/routers/api/packages/container/container.go b/routers/api/packages/container/container.go index 477c3bc71a..d1b80daccf 100644 --- a/routers/api/packages/container/container.go +++ b/routers/api/packages/container/container.go @@ -320,6 +320,7 @@ func PostBlobsUploads(ctx *context.Context) { // https://github.com/opencontainers/distribution-spec/blob/main/spec.md#pushing-a-blob-in-chunks func GetBlobsUpload(ctx *context.Context) { + image := ctx.PathParam("image") uuid := ctx.PathParam("uuid") upload, err := packages_model.GetBlobUploadByID(ctx, uuid) @@ -334,6 +335,7 @@ func GetBlobsUpload(ctx *context.Context) { // FIXME: undefined behavior when the uploaded content is empty: https://github.com/opencontainers/distribution-spec/issues/578 respHeaders := &containerHeaders{ + Location: fmt.Sprintf("/v2/%s/%s/blobs/uploads/%s", ctx.Package.Owner.LowerName, image, upload.ID), UploadUUID: upload.ID, Status: http.StatusNoContent, } @@ -386,7 +388,7 @@ func PatchBlobsUpload(ctx *context.Context) { UploadUUID: uploader.ID, Status: http.StatusAccepted, } - if contentRange != "" { + if uploader.Size() > 0 { respHeaders.Range = fmt.Sprintf("0-%d", uploader.Size()-1) } setResponseHeaders(ctx.Resp, respHeaders) @@ -705,7 +707,7 @@ func DeleteManifest(ctx *context.Context) { func serveBlob(ctx *context.Context, pfd *packages_model.PackageFileDescriptor) { serveDirectReqParams := make(url.Values) serveDirectReqParams.Set("response-content-type", pfd.Properties.GetByName(container_module.PropertyMediaType)) - s, u, _, err := packages_service.GetPackageBlobStream(ctx, pfd.File, pfd.Blob, serveDirectReqParams) + s, u, _, err := packages_service.OpenBlobForDownload(ctx, pfd.File, pfd.Blob, serveDirectReqParams) if err != nil { apiError(ctx, http.StatusInternalServerError, err) return |