From 21a08786651b4c0ef73862dadda7729ebef6938f Mon Sep 17 00:00:00 2001 From: Michal Minar Date: Thu, 18 Feb 2016 19:20:53 +0100 Subject: [PATCH] Commit blob with known size Signed-off-by: Michal Minar --- registry/handlers/blobupload.go | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/registry/handlers/blobupload.go b/registry/handlers/blobupload.go index e2c34d83..31a3367f 100644 --- a/registry/handlers/blobupload.go +++ b/registry/handlers/blobupload.go @@ -239,12 +239,18 @@ func (buh *blobUploadHandler) PutBlobUploadComplete(w http.ResponseWriter, r *ht return } + size := buh.State.Offset + if offset, err := buh.Upload.Seek(0, os.SEEK_CUR); err == nil { + size = offset + } + desc, err := buh.Upload.Commit(buh, distribution.Descriptor{ Digest: dgst, + Size: size, // TODO(stevvooe): This isn't wildly important yet, but we should - // really set the length and mediatype. For now, we can let the - // backend take care of this. + // really set the mediatype. For now, we can let the backend take care + // of this. }) if err != nil {