Skip to content

Commit

Permalink
return empty reader for 0 byte files
Browse files Browse the repository at this point in the history
Signed-off-by: Jörn Friedrich Dreyer <[email protected]>
  • Loading branch information
butonic committed Sep 19, 2023
1 parent 76662f5 commit aeab6fc
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions pkg/storage/utils/decomposedfs/decomposedfs.go
Original file line number Diff line number Diff line change
Expand Up @@ -790,6 +790,9 @@ func (fs *Decomposedfs) Download(ctx context.Context, ref *provider.Reference) (
if currentEtag != expectedEtag {
return nil, errtypes.Aborted(fmt.Sprintf("file changed from etag %s to %s", expectedEtag, currentEtag))
}
if n.Blobsize == 0 {
return io.NopCloser(strings.NewReader("")), nil
}
reader, err := fs.blobstore.Download(n)
if err != nil {
return nil, errors.Wrap(err, "Decomposedfs: error downloading blob '"+n.BlobID+"' for node '"+n.ID+"'")
Expand Down

0 comments on commit aeab6fc

Please sign in to comment.