mirror of
https://github.com/grafana/grafana.git
synced 2025-02-12 00:25:46 -06:00
Alerting: Fix email image embedding on Windows. (#56766)
The email notifier was incorrectly handling Windows filepaths. This is fixed by using the `path/filepath` package.
This commit is contained in:
parent
254bb0c99e
commit
c7c640d903
@ -6,6 +6,7 @@ import (
|
||||
"net/url"
|
||||
"os"
|
||||
"path"
|
||||
"path/filepath"
|
||||
|
||||
"github.com/prometheus/alertmanager/template"
|
||||
"github.com/prometheus/alertmanager/types"
|
||||
@ -116,7 +117,7 @@ func (en *EmailNotifier) Notify(ctx context.Context, alerts ...*types.Alert) (bo
|
||||
} else if len(image.Path) != 0 {
|
||||
_, err := os.Stat(image.Path)
|
||||
if err == nil {
|
||||
data.Alerts[index].EmbeddedImage = path.Base(image.Path)
|
||||
data.Alerts[index].EmbeddedImage = filepath.Base(image.Path)
|
||||
embeddedFiles = append(embeddedFiles, image.Path)
|
||||
} else {
|
||||
en.log.Warn("failed to get image file for email attachment", "file", image.Path, "err", err)
|
||||
|
Loading…
Reference in New Issue
Block a user