Explorar el Código

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

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

fixes #13079
Carl Bergquist hace 7 años
padre
commit
ee1083d9b4
Se han modificado 1 ficheros con 1 adiciones y 1 borrados
  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
 		return err
 	}
 	}
 
 
-	r, err := zip.NewReader(bytes.NewReader(body), resp.ContentLength)
+	r, err := zip.NewReader(bytes.NewReader(body), int64(len(body)))
 	if err != nil {
 	if err != nil {
 		return err
 		return err
 	}
 	}