Skip to content

Commit

Permalink
Fix email autolink starting w/ @
Browse files Browse the repository at this point in the history
  • Loading branch information
wooorm committed Apr 23, 2024
1 parent 3dc7f1a commit aa9a6b6
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/construct/autolink.rs
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,7 @@ pub fn open(tokenizer: &mut Tokenizer) -> State {
tokenizer.consume();
State::Next(StateName::AutolinkSchemeOrEmailAtext)
}
Some(b'@') => State::Nok,
_ => State::Retry(StateName::AutolinkEmailAtext),
}
}
Expand Down
6 changes: 6 additions & 0 deletions tests/autolink.rs
Original file line number Diff line number Diff line change
Expand Up @@ -251,6 +251,12 @@ fn autolink() -> Result<(), message::Message> {
"should not support a dash before a dot in email autolinks"
);

assert_eq!(
to_html("<@example.com>"),
"<p>&lt;@example.com&gt;</p>",
"should not support an at sign at the start of email autolinks"
);

assert_eq!(
to_html_with_options(
"<a@b.co>",
Expand Down

0 comments on commit aa9a6b6

Please sign in to comment.