Skip to content

Commit 901471f

Browse files
committed
fix
1 parent 0d3e995 commit 901471f

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

routers/api/packages/container/container.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -312,8 +312,8 @@ func InitiateUploadBlob(ctx *context.Context) {
312312
}
313313

314314
setResponseHeaders(ctx.Resp, &containerHeaders{
315-
Location: fmt.Sprintf("/v2/%s/%s/blobs/uploads/%s", ctx.Package.Owner.LowerName, image, upload.ID),
316-
Range: "0-0",
315+
Location: fmt.Sprintf("/v2/%s/%s/blobs/uploads/%s", ctx.Package.Owner.LowerName, image, upload.ID),
316+
// Range: "0-0", // FIXME: why it is needed? Spec doesn't mention it, and it is not right: "0-0" means the first byte (len=1)
317317
UploadUUID: upload.ID,
318318
Status: http.StatusAccepted,
319319
})
@@ -334,7 +334,7 @@ func GetUploadBlob(ctx *context.Context) {
334334
}
335335

336336
setResponseHeaders(ctx.Resp, &containerHeaders{
337-
Range: fmt.Sprintf("0-%d", upload.BytesReceived),
337+
// Range: fmt.Sprintf("0-%d", upload.BytesReceived), // FIXME: not right, the "range-end" should be "len-1"
338338
UploadUUID: upload.ID,
339339
Status: http.StatusNoContent,
340340
})
@@ -378,8 +378,8 @@ func UploadBlob(ctx *context.Context) {
378378
}
379379

380380
setResponseHeaders(ctx.Resp, &containerHeaders{
381-
Location: fmt.Sprintf("/v2/%s/%s/blobs/uploads/%s", ctx.Package.Owner.LowerName, image, uploader.ID),
382-
Range: fmt.Sprintf("0-%d", uploader.Size()-1),
381+
Location: fmt.Sprintf("/v2/%s/%s/blobs/uploads/%s", ctx.Package.Owner.LowerName, image, uploader.ID),
382+
// Range: fmt.Sprintf("0-%d", uploader.Size()-1), // FIXME: not right, when "uploader.Size()" is 0, it results in "0--1" which is not a valid range
383383
UploadUUID: uploader.ID,
384384
Status: http.StatusAccepted,
385385
})

0 commit comments

Comments
 (0)