mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-02-26 23:57:23 +00:00
swarm/api: close tar writer in GetDirectoryTar to flush and clean (#17339)
This commit is contained in:
parent
d3e4c2dcb0
commit
3bcb501c8f
1 changed files with 4 additions and 0 deletions
|
|
@ -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…
Reference in a new issue