aboutsummaryrefslogtreecommitdiff
path: root/vendor/github.com/google/go-github/github/repos_contents.go
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/github.com/google/go-github/github/repos_contents.go')
-rw-r--r--vendor/github.com/google/go-github/github/repos_contents.go8
1 files changed, 6 insertions, 2 deletions
diff --git a/vendor/github.com/google/go-github/github/repos_contents.go b/vendor/github.com/google/go-github/github/repos_contents.go
index ebf4d04..7b08cf0 100644
--- a/vendor/github.com/google/go-github/github/repos_contents.go
+++ b/vendor/github.com/google/go-github/github/repos_contents.go
@@ -267,8 +267,12 @@ func (s *RepositoriesService) GetArchiveLink(owner, repo string, archiveformat a
} else {
resp, err = s.client.client.Transport.RoundTrip(req)
}
- if err != nil || resp.StatusCode != http.StatusFound {
- return nil, newResponse(resp), err
+ if err != nil {
+ return nil, nil, err
+ }
+ resp.Body.Close()
+ if resp.StatusCode != http.StatusFound {
+ return nil, newResponse(resp), fmt.Errorf("unexpected status code: %s", resp.Status)
}
parsedURL, err := url.Parse(resp.Header.Get("Location"))
return parsedURL, newResponse(resp), err