Skip to content

Commit

Permalink
EmailConfig: Use CanonicalMIMEHeaderKey instead of TitleCasing for he…
Browse files Browse the repository at this point in the history
…aders

Fixes #3064.

Signed-off-by: Joe Blubaugh <joe.blubaugh@grafana.com>
  • Loading branch information
joeblubaugh committed Sep 21, 2022
1 parent efc956c commit 289de2a
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion config/notifiers.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ package config

import (
"fmt"
"net/textproto"
"regexp"
"strings"
"time"
Expand Down Expand Up @@ -194,7 +195,7 @@ func (c *EmailConfig) UnmarshalYAML(unmarshal func(interface{}) error) error {
// Header names are case-insensitive, check for collisions.
normalizedHeaders := map[string]string{}
for h, v := range c.Headers {
normalized := normalizeTitle.String(h)
normalized := textproto.CanonicalMIMEHeaderKey(h)
if _, ok := normalizedHeaders[normalized]; ok {
return fmt.Errorf("duplicate header %q in email config", normalized)
}
Expand Down

0 comments on commit 289de2a

Please sign in to comment.