Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions pkg/storage/imagestore/imagestore.go
Original file line number Diff line number Diff line change
Expand Up @@ -943,7 +943,9 @@ func (is *ImageStore) PutBlobChunk(repo, uuid string, from, to int64,

defer file.Close()

if from != file.Size() {
fsize := file.Size()

if from != fsize {
is.log.Error().Int64("expected", from).Int64("actual", file.Size()).
Msg("invalid range start for blob upload")

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

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

return n, err
return n + fsize, err
}

// BlobUploadInfo returns the current blob size in bytes.
Expand Down
2 changes: 1 addition & 1 deletion pkg/storage/storage_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -493,7 +493,7 @@ func TestStorageAPIs(t *testing.T) {

bupload, err = imgStore.PutBlobChunk("test", upload, int64(firstChunkLen), int64(buflen), secondChunkBuf)
So(err, ShouldBeNil)
So(bupload, ShouldEqual, secondChunkLen)
So(bupload, ShouldEqual, int64(firstChunkLen+secondChunkLen))

err = imgStore.FinishBlobUpload("test", upload, buf, digest)
So(err, ShouldBeNil)
Expand Down
Loading