Skip to content

Commit

Permalink
address: Special-case null return-path in normalization functions
Browse files Browse the repository at this point in the history
See #629.
  • Loading branch information
foxcpp committed Feb 8, 2024
1 parent 4a69c9e commit cee5777
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions framework/address/norm.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,10 @@ import (
//
// On error, case-folded addr is also returned.
func ForLookup(addr string) (string, error) {
if addr == "" { // Null return-path case.
return "", nil
}

mbox, domain, err := Split(addr)
if err != nil {
return strings.ToLower(addr), err
Expand Down Expand Up @@ -64,6 +68,10 @@ func ForLookup(addr string) (string, error) {
//
// Original value is also returned on the error.
func CleanDomain(addr string) (string, error) {
if addr == "" { // Null return-path
return "", nil
}

mbox, domain, err := Split(addr)
if err != nil {
return addr, err
Expand Down

0 comments on commit cee5777

Please sign in to comment.