Skip to content

Commit

Permalink
fix address name containing @ (#80)
Browse files Browse the repository at this point in the history
  • Loading branch information
soywod authored Mar 14, 2024
1 parent cf87d35 commit ad4dff6
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 3 deletions.
4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ readme = "README.md"
resolver = "2"

[dependencies]
encoding_rs = { version="0.8", optional=true }
serde = { version = "1.0", features = ["derive"], optional=true }
encoding_rs = { version = "0.8", optional = true }
serde = { version = "1.0", features = ["derive"], optional = true }

[dev-dependencies]
mail-parser = { path = ".", features = ["serde_support", "full_encoding"] }
Expand Down
35 changes: 34 additions & 1 deletion resources/address.json
Original file line number Diff line number Diff line change
Expand Up @@ -744,5 +744,38 @@
}
]
}
},
{
"header": "\"[email protected]\" <[email protected]>\n",
"expected": {
"List": [
{
"name": "[email protected]",
"address": "[email protected]"
}
]
}
},
{
"header": "\"<[email protected]>\" <[email protected]>\n",
"expected": {
"List": [
{
"name": "<[email protected]>",
"address": "[email protected]"
}
]
}
},
{
"header": "[email protected] <[email protected]>\n",
"expected": {
"List": [
{
"name": "[email protected]",
"address": "[email protected]"
}
]
}
}
]
]
1 change: 1 addition & 0 deletions src/parsers/fields/address.rs
Original file line number Diff line number Diff line change
Expand Up @@ -247,6 +247,7 @@ impl<'x> MessageStream<'x> {
continue;
}
b'<' if parser.state == AddressState::Name => {
parser.is_token_email = false;
parser.add_token(self, false);
parser.state_stack.push(AddressState::Name);
parser.state = AddressState::Address;
Expand Down

0 comments on commit ad4dff6

Please sign in to comment.