diff --git a/CHANGELOG.md b/CHANGELOG.md index eb76150c21f..acefeaec860 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -26,6 +26,7 @@ * **InfluxDB**: Fix for InfluxDB and table panel when using Format As Table and having group by time, fixes [#3928](https://github.com/grafana/grafana/issues/3928) * **Panel Time shift**: Fix for panel time range and using dashboard times liek `Today` and `This Week`, fixes [#3941](https://github.com/grafana/grafana/issues/3941) * **Row repeat**: Repeated rows will now appear next to each other and not by the bottom of the dashboard, fixes [#3942](https://github.com/grafana/grafana/issues/3942) +* **Png renderer**: Fix for phantomjs path on windows, fixes [#3657](https://github.com/grafana/grafana/issues/3657) # 2.6.1 (unrelased, 2.6.x branch) diff --git a/pkg/components/renderer/renderer.go b/pkg/components/renderer/renderer.go index 1cff3e0ac17..d72ceca9c3d 100644 --- a/pkg/components/renderer/renderer.go +++ b/pkg/components/renderer/renderer.go @@ -5,6 +5,7 @@ import ( "os" "os/exec" "path/filepath" + "runtime" "time" "github.com/grafana/grafana/pkg/log" @@ -21,7 +22,13 @@ type RenderOpts struct { func RenderToPng(params *RenderOpts) (string, error) { log.Info("PhantomRenderer::renderToPng url %v", params.Url) - binPath, _ := filepath.Abs(filepath.Join(setting.PhantomDir, "phantomjs")) + + var executable = "phantomjs" + if runtime.GOOS == "windows" { + executable = executable + ".exe" + } + + binPath, _ := filepath.Abs(filepath.Join(setting.PhantomDir, executable)) scriptPath, _ := filepath.Abs(filepath.Join(setting.PhantomDir, "render.js")) pngPath, _ := filepath.Abs(filepath.Join(setting.ImagesDir, util.GetRandomString(20))) pngPath = pngPath + ".png"