Skip to content

Commit

Permalink
remotes/docker/pusher.go: Fix missing Close()
Browse files Browse the repository at this point in the history
Signed-off-by: Shiming Zhang <wzshiming@foxmail.com>
(cherry picked from commit 53ec1ab)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
  • Loading branch information
wzshiming authored and thaJeztah committed Jul 21, 2021
1 parent 2f11d58 commit 7b17268
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions remotes/docker/pusher.go
Original file line number Diff line number Diff line change
Expand Up @@ -143,13 +143,16 @@ func (p dockerPusher) push(ctx context.Context, desc ocispec.Descriptor, ref str
// TODO: Set updated time?
},
})
resp.Body.Close()
return nil, errors.Wrapf(errdefs.ErrAlreadyExists, "content %v on remote", desc.Digest)
}
} else if resp.StatusCode != http.StatusNotFound {
err := remoteserrors.NewUnexpectedStatusErr(resp)
log.G(ctx).WithField("resp", resp).WithField("body", string(err.(remoteserrors.ErrUnexpectedStatus).Body)).Debug("unexpected response")
resp.Body.Close()
return nil, err
}
resp.Body.Close()
}

if isManifest {
Expand Down

0 comments on commit 7b17268

Please sign in to comment.