Skip to content

Commit 64bd2a9

Browse files
committed
fix: return the entire blob size in patch upload response
regclient/regclient#961 opencontainers/distribution-spec#581 Previously, zot returned the size of the currently uploaded chunk. Other registries the size of the entire blob. Align with the latter behavior. Signed-off-by: Ramkumar Chinchani <rchincha.dev@gmail.com>
1 parent b2a5afc commit 64bd2a9

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

pkg/storage/imagestore/imagestore.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -943,7 +943,9 @@ func (is *ImageStore) PutBlobChunk(repo, uuid string, from, to int64,
943943

944944
defer file.Close()
945945

946-
if from != file.Size() {
946+
fsize := file.Size()
947+
948+
if from != fsize {
947949
is.log.Error().Int64("expected", from).Int64("actual", file.Size()).
948950
Msg("invalid range start for blob upload")
949951

@@ -952,7 +954,7 @@ func (is *ImageStore) PutBlobChunk(repo, uuid string, from, to int64,
952954

953955
n, err := io.Copy(file, body)
954956

955-
return n, err
957+
return n + fsize, err
956958
}
957959

958960
// BlobUploadInfo returns the current blob size in bytes.

0 commit comments

Comments
 (0)