diff options
| author | qinguoyi <1532979219@qq.com> | 2024-08-03 00:46:37 +0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-08-02 09:46:37 -0700 |
| commit | 606d0cba64f32de9d4d69470a3f7de29de4e0e2d (patch) | |
| tree | abd2e81e8ab828827da16b5fd3e137e926144aa0 | |
| parent | b74b506e52160e512ae59db8cd79ec56cd981ed9 (diff) | |
| download | seaweedfs-606d0cba64f32de9d4d69470a3f7de29de4e0e2d.tar.xz seaweedfs-606d0cba64f32de9d4d69470a3f7de29de4e0e2d.zip | |
Fix extractToFile gz file nil bug (#5847)
| -rw-r--r-- | weed/command/update.go | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/weed/command/update.go b/weed/command/update.go index 4f2b66b2e..bf871d654 100644 --- a/weed/command/update.go +++ b/weed/command/update.go @@ -20,8 +20,8 @@ import ( "github.com/seaweedfs/seaweedfs/weed/glog" "github.com/seaweedfs/seaweedfs/weed/util" - "golang.org/x/net/context/ctxhttp" 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 @@ -309,7 +309,12 @@ func extractToFile(buf []byte, filename, target string) error { trd := tar.NewReader(gr) hdr, terr := trd.Next() if terr != nil { - glog.Errorf("uncompress file(%s) failed:%s", hdr.Name, terr) + if hdr != nil { + glog.Errorf("uncompress file(%s) failed:%s", hdr.Name, terr) + } else { + glog.Errorf("uncompress file is nil, failed:%s", terr) + } + return terr } rd = trd |
