Browse Source

cli: avoid rely on response.ContentLength (#13120)

response.ContentLength might be invalid if the http response
is chunked.

fixes #13079
Carl Bergquist 7 years ago
parent
commit
ee1083d9b4
1 changed files with 1 additions and 1 deletions
  1. 1 1
      pkg/cmd/grafana-cli/commands/install_command.go

+ 1 - 1
pkg/cmd/grafana-cli/commands/install_command.go

@@ -152,7 +152,7 @@ func downloadFile(pluginName, filePath, url string) (err error) {
 		return err
 	}
 
-	r, err := zip.NewReader(bytes.NewReader(body), resp.ContentLength)
+	r, err := zip.NewReader(bytes.NewReader(body), int64(len(body)))
 	if err != nil {
 		return err
 	}