mirror of
https://github.com/mjl-/mox.git
synced 2025-07-12 20:54:39 +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:
@ -116,7 +116,11 @@ func Verify(elog *slog.Logger, r io.ReaderAt, key []byte, period time.Duration)
|
||||
if err != nil {
|
||||
return fmt.Errorf("%w: from address with bad domain: %v", ErrFrom, err)
|
||||
}
|
||||
addr := smtp.Address{Localpart: smtp.Localpart(from.User), Domain: d}.Pack(true)
|
||||
lp, err := smtp.ParseLocalpart(from.User)
|
||||
if err != nil {
|
||||
return fmt.Errorf("%w: from address with bad localpart: %v", ErrFrom, err)
|
||||
}
|
||||
addr := smtp.Address{Localpart: lp, Domain: d}.Pack(true)
|
||||
|
||||
buf, err := base64.RawURLEncoding.DecodeString(token)
|
||||
if err != nil {
|
||||
|
Reference in New Issue
Block a user