Browse Source

Fix extractToFile gz file nil bug (#5847)

pull/5855/head
qinguoyi 5 months ago
committed by GitHub
parent
commit
606d0cba64
No known key found for this signature in database GPG Key ID: B5690EEEBB952194
  1. 7
      weed/command/update.go

7
weed/command/update.go

@ -20,8 +20,8 @@ import (
"github.com/seaweedfs/seaweedfs/weed/glog" "github.com/seaweedfs/seaweedfs/weed/glog"
"github.com/seaweedfs/seaweedfs/weed/util" "github.com/seaweedfs/seaweedfs/weed/util"
"golang.org/x/net/context/ctxhttp"
util_http "github.com/seaweedfs/seaweedfs/weed/util/http" util_http "github.com/seaweedfs/seaweedfs/weed/util/http"
"golang.org/x/net/context/ctxhttp"
) )
//copied from https://github.com/restic/restic/tree/master/internal/selfupdate //copied from https://github.com/restic/restic/tree/master/internal/selfupdate
@ -309,7 +309,12 @@ func extractToFile(buf []byte, filename, target string) error {
trd := tar.NewReader(gr) trd := tar.NewReader(gr)
hdr, terr := trd.Next() hdr, terr := trd.Next()
if terr != nil { if terr != nil {
if hdr != nil {
glog.Errorf("uncompress file(%s) failed:%s", hdr.Name, terr) glog.Errorf("uncompress file(%s) failed:%s", hdr.Name, terr)
} else {
glog.Errorf("uncompress file is nil, failed:%s", terr)
}
return terr return terr
} }
rd = trd rd = trd

Loading…
Cancel
Save