mirror of
https://github.com/mjl-/mox.git
synced 2025-07-12 11:04:38 +03:00
normalize localparts with unicode nfc when parsing
both when parsing our configs, and for incoming on smtp or in messages. so we properly compare things like é and e+accent as equal, and accept the different encodings of that same address.
This commit is contained in:
@ -36,6 +36,7 @@ import (
|
||||
_ "embed"
|
||||
|
||||
"golang.org/x/exp/maps"
|
||||
"golang.org/x/text/unicode/norm"
|
||||
|
||||
"github.com/mjl-/adns"
|
||||
|
||||
@ -1880,7 +1881,7 @@ func (Admin) DomainAdd(ctx context.Context, domain, accountName, localpart strin
|
||||
d, err := dns.ParseDomain(domain)
|
||||
xcheckuserf(ctx, err, "parsing domain")
|
||||
|
||||
err = mox.DomainAdd(ctx, d, accountName, smtp.Localpart(localpart))
|
||||
err = mox.DomainAdd(ctx, d, accountName, smtp.Localpart(norm.NFC.String(localpart)))
|
||||
xcheckf(ctx, err, "adding domain")
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user