From d13aff6c06d3e309718808f02cfaf30d23307eb5 Mon Sep 17 00:00:00 2001 From: kychen Date: Tue, 26 May 2020 15:14:50 +0800 Subject: [PATCH] =?UTF-8?q?=E8=BF=94=E5=9B=9E=E4=B8=8A=E4=BC=A0=E7=BB=93?= =?UTF-8?q?=E6=9E=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- registry/blob.go | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/registry/blob.go b/registry/blob.go index 4d5fc5a4..18c2ee41 100644 --- a/registry/blob.go +++ b/registry/blob.go @@ -21,10 +21,10 @@ func (registry *Registry) DownloadBlob(repository string, digest digest.Digest) return resp.Body, nil } -func (registry *Registry) UploadBlob(repository string, digest digest.Digest, content io.Reader) error { +func (registry *Registry) UploadBlob(repository string, digest digest.Digest, content io.Reader) (*http.Response, error) { uploadURL, err := registry.initiateUpload(repository) if err != nil { - return err + return nil, err } q := uploadURL.Query() q.Set("digest", digest.String()) @@ -34,12 +34,12 @@ func (registry *Registry) UploadBlob(repository string, digest digest.Digest, co upload, err := http.NewRequest("PUT", uploadURL.String(), content) if err != nil { - return err + return nil, err } upload.Header.Set("Content-Type", "application/octet-stream") - _, err = registry.Client.Do(upload) - return err + resp, err := registry.Client.Do(upload) + return resp, err } func (registry *Registry) HasBlob(repository string, digest digest.Digest) (bool, error) {