swarm/api: close tar writer in GetDirectoryTar to flush and clean (#17339)

pull/17374/head
Janoš Guljaš 6 years ago committed by Balint Gabor
parent d3e4c2dcb0
commit 3bcb501c8f
  1. 4
      swarm/api/api.go

@ -525,6 +525,10 @@ func (a *API) GetDirectoryTar(ctx context.Context, uri *URI) (io.ReadCloser, err
return nil
})
// close tar writer before closing pipew
// to flush remaining data to pipew
// regardless of error value
tw.Close()
if err != nil {
apiGetTarFail.Inc(1)
pipew.CloseWithError(err)

Loading…
Cancel
Save