aboutsummaryrefslogtreecommitdiff
path: root/weed/command/update.go
diff options
context:
space:
mode:
authorchrislu <chris.lu@gmail.com>2024-08-10 10:01:57 -0700
committerchrislu <chris.lu@gmail.com>2024-08-10 10:01:57 -0700
commit7438648d1cfacd5ca570dd029d1bdb5fd271bd70 (patch)
treecf12b49473be0373cb03d83470ddc75708454171 /weed/command/update.go
parent49893267e978cc3fda00dc991e00099742fb5a9d (diff)
parent63c707f9c1b4dc469ec39c446563c324ce4ccb6f (diff)
downloadseaweedfs-7438648d1cfacd5ca570dd029d1bdb5fd271bd70.tar.xz
seaweedfs-7438648d1cfacd5ca570dd029d1bdb5fd271bd70.zip
Merge branch 'master' into mq
Diffstat (limited to 'weed/command/update.go')
-rw-r--r--weed/command/update.go12
1 files changed, 9 insertions, 3 deletions
diff --git a/weed/command/update.go b/weed/command/update.go
index 314a903f2..bf871d654 100644
--- a/weed/command/update.go
+++ b/weed/command/update.go
@@ -20,6 +20,7 @@ import (
"github.com/seaweedfs/seaweedfs/weed/glog"
"github.com/seaweedfs/seaweedfs/weed/util"
+ util_http "github.com/seaweedfs/seaweedfs/weed/util/http"
"golang.org/x/net/context/ctxhttp"
)
@@ -198,7 +199,7 @@ func GitHubLatestRelease(ctx context.Context, ver string, owner, repo string) (R
if err != nil {
return Release{}, err
}
- defer util.CloseResponse(res)
+ defer util_http.CloseResponse(res)
if res.StatusCode != http.StatusOK {
content := res.Header.Get("Content-Type")
@@ -258,7 +259,7 @@ func getGithubData(ctx context.Context, url string) ([]byte, error) {
if err != nil {
return nil, err
}
- defer util.CloseResponse(res)
+ defer util_http.CloseResponse(res)
if res.StatusCode != http.StatusOK {
return nil, fmt.Errorf("unexpected status %v (%v) returned", res.StatusCode, res.Status)
@@ -308,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