From b94a99dded88cf8ccaa0206fd138b32345268eab Mon Sep 17 00:00:00 2001
From: Wenkai Yin <yinw@vmware.com>
Date: Thu, 15 Aug 2019 10:52:08 +0800
Subject: [PATCH] Set content length when pushing blobs

Set content length when pushing blobs

Signed-off-by: Wenkai Yin <yinw@vmware.com>
---
 src/common/utils/registry/repository.go | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/src/common/utils/registry/repository.go b/src/common/utils/registry/repository.go
index f7304499cf..7a4a1c6c76 100644
--- a/src/common/utils/registry/repository.go
+++ b/src/common/utils/registry/repository.go
@@ -25,11 +25,9 @@ import (
 	"sort"
 	"strconv"
 	"strings"
-	//	"time"
 
 	"github.com/docker/distribution/manifest/schema1"
 	"github.com/docker/distribution/manifest/schema2"
-
 	commonhttp "github.com/goharbor/harbor/src/common/http"
 	"github.com/goharbor/harbor/src/common/utils"
 )
@@ -407,6 +405,7 @@ func (r *Repository) monolithicBlobUpload(location, digest string, size int64, d
 	if err != nil {
 		return err
 	}
+	req.ContentLength = size
 
 	resp, err := r.client.Do(req)
 	if err != nil {