Skip to content

Commit

Permalink
[lxd-import] client/lxd/images: Propagate error (if any) when streami…
Browse files Browse the repository at this point in the history
…ng split tarballs

Signed-off-by: montag451 <[email protected]>
  • Loading branch information
montag451 authored and stgraber committed Oct 4, 2023
1 parent 52d92c1 commit 5becdd2
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions client/incus_images.go
Original file line number Diff line number Diff line change
Expand Up @@ -422,9 +422,14 @@ func (r *ProtocolIncus) CreateImage(image api.ImagesPost, args *ImageCreateArgs)
w := multipart.NewWriter(pw)

go func() {
var ioErr error
defer func() {
w.Close()
pw.Close()
cerr := w.Close()
if ioErr == nil && cerr != nil {
ioErr = cerr
}

_ = pw.CloseWithError(ioErr)
}()

// Metadata file
Expand Down

0 comments on commit 5becdd2

Please sign in to comment.