Skip to content

Commit

Permalink
remotes: fix nil RangeReadCloser handle
Browse files Browse the repository at this point in the history
Signed-off-by: Yan Song <yansong.ys@antgroup.com>
  • Loading branch information
imeoer committed Feb 12, 2025
1 parent ecf1c7a commit ba683ad
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions remotes/docker/pusher.go
Original file line number Diff line number Diff line change
Expand Up @@ -239,8 +239,8 @@ func (p dockerPusher) push(ctx context.Context, desc ocispec.Descriptor, rr remo
return nil, err
}

if host.ChunkSize > 0 {
return nil, p.pushInChunked(ctx, desc, rr, ref, &host, resp)
if host.ChunkSize > 0 && rr != nil {
return nil, p.pushInChunked(ctx, desc, rr, &host, resp)
} else {
lurl, lhost, err := parseLocation(ctx, resp, &host)
if err != nil {
Expand Down Expand Up @@ -298,7 +298,7 @@ func (p dockerPusher) pushInMonolithic(ctx context.Context, req *request, desc o
return pushw, nil
}

func (p dockerPusher) pushInChunked(ctx context.Context, desc ocispec.Descriptor, rr remotes.RangeReadCloser, ref string, host *RegistryHost, resp *http.Response) error {
func (p dockerPusher) pushInChunked(ctx context.Context, desc ocispec.Descriptor, rr remotes.RangeReadCloser, host *RegistryHost, resp *http.Response) error {
chunks := splitChunks(desc.Size, host.ChunkSize)

pushChunk := func(ctx context.Context, c chunk, last bool) error {
Expand Down

0 comments on commit ba683ad

Please sign in to comment.