Rendering: Check if default image exists to avoid breaking reports if it's moved (#40930)
This commit is contained in:
@@ -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
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user