Rendering: Check if default image exists to avoid breaking reports if it's moved (#40930) (#40991)

(cherry picked from commit 37cbed4b48)

Co-authored-by: Selene <selenepinillos@gmail.com>
This commit is contained in:
Grot (@grafanabot)
2021-10-27 16:41:47 +02:00
committed by GitHub
co-authored by Selene
parent 10135a4851
commit c3e46eaa8f
+5 -1
View File
@@ -159,9 +159,13 @@ func (rs *RenderingService) Version() string {
func (rs *RenderingService) RenderErrorImage(err error) (*RenderResult, error) {
imgUrl := "public/img/rendering_error.png"
imgPath := filepath.Join(setting.HomePath, imgUrl)
if _, err := os.Stat(imgPath); errors.Is(err, os.ErrNotExist) {
return nil, err
}
return &RenderResult{
FilePath: filepath.Join(setting.HomePath, imgUrl),
FilePath: imgPath,
}, nil
}