mirror of
https://github.com/containers/skopeo.git
synced 2025-04-27 19:05:32 +00:00
Always close the blob we are reading from a registry
== the HTTP response body. Signed-off-by: Miloslav Trmač <mitr@redhat.com>
This commit is contained in:
parent
603d37c588
commit
a0799484c8
@ -151,10 +151,12 @@ func (opts *layersOptions) run(args []string, stdout io.Writer) (retErr error) {
|
||||
}, opts.retryOpts); err != nil {
|
||||
return err
|
||||
}
|
||||
if _, err := dest.PutBlob(ctx, r, types.BlobInfo{Digest: bd.digest, Size: blobSize}, cache, bd.isConfig); err != nil {
|
||||
if closeErr := r.Close(); closeErr != nil {
|
||||
return fmt.Errorf("%w (close error: %v)", err, closeErr)
|
||||
defer func() {
|
||||
if err := r.Close(); err != nil {
|
||||
retErr = noteCloseFailure(retErr, fmt.Sprintf("closing blob %q", bd.digest.String()), err)
|
||||
}
|
||||
}()
|
||||
if _, err := dest.PutBlob(ctx, r, types.BlobInfo{Digest: bd.digest, Size: blobSize}, cache, bd.isConfig); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user