aboutsummaryrefslogtreecommitdiffstats
path: root/swarm
diff options
context:
space:
mode:
authorJanoš Guljaš <janos@users.noreply.github.com>2018-08-09 22:15:07 +0800
committerBalint Gabor <balint.g@gmail.com>2018-08-09 22:15:07 +0800
commit3bcb501c8fefeec1bc8aac26686460cae86f2ccb (patch)
tree51d3251a1d0042d042981d334a996939ebe7ceb0 /swarm
parentd3e4c2dcb00eb61c32dd3a9b94a317727c2449a7 (diff)
downloaddexon-3bcb501c8fefeec1bc8aac26686460cae86f2ccb.tar.gz
dexon-3bcb501c8fefeec1bc8aac26686460cae86f2ccb.tar.zst
dexon-3bcb501c8fefeec1bc8aac26686460cae86f2ccb.zip
swarm/api: close tar writer in GetDirectoryTar to flush and clean (#17339)
Diffstat (limited to 'swarm')
-rw-r--r--swarm/api/api.go4
1 files changed, 4 insertions, 0 deletions
diff --git a/swarm/api/api.go b/swarm/api/api.go
index ad4bd7dcb..b418c45e1 100644
--- a/swarm/api/api.go
+++ b/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)