mirror of
https://blitiri.com.ar/repos/chasquid
synced 2025-12-17 14:37:02 +00:00
aliases: Normalize right-hand side addresses
The right-hand side addresses of an alias should be normalized, to maintain the internal invariant that we always deal with normalized addresses. Otherwise, strange situations may arise, such as the same domain having two different domaininfo structures depending on case.
This commit is contained in:
@@ -299,6 +299,7 @@ func parseFile(domain, path string) (map[string][]Recipient, error) {
|
||||
if !strings.Contains(a, "@") {
|
||||
a = a + "@" + domain
|
||||
}
|
||||
a, _ = normalize.Addr(a)
|
||||
rs = append(rs, Recipient{a, EMAIL})
|
||||
}
|
||||
aliases[addr] = rs
|
||||
|
||||
@@ -237,6 +237,9 @@ a@dom: x@dom
|
||||
o1: a
|
||||
o1: b
|
||||
|
||||
# Check that we normalize the right hand side.
|
||||
aA: bB@dom-B
|
||||
|
||||
# Finally one to make the file NOT end in \n:
|
||||
y: z`
|
||||
|
||||
@@ -255,6 +258,8 @@ func TestRichFile(t *testing.T) {
|
||||
{"c@dom", []Recipient{{"d@e", EMAIL}, {"f@dom", EMAIL}}},
|
||||
{"x@dom", []Recipient{{"command", PIPE}}},
|
||||
{"o1@dom", []Recipient{{"b@dom", EMAIL}}},
|
||||
{"aA@dom", []Recipient{{"bb@dom-b", EMAIL}}},
|
||||
{"aa@dom", []Recipient{{"bb@dom-b", EMAIL}}},
|
||||
{"y@dom", []Recipient{{"z@dom", EMAIL}}},
|
||||
}
|
||||
cases.check(t, resolver)
|
||||
|
||||
Reference in New Issue
Block a user