Skip to content

Commit

Permalink
disable control characters in link definitions
Browse files Browse the repository at this point in the history
  • Loading branch information
mikeando committed May 29, 2022
1 parent 0deecf6 commit 87c6483
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/parser/inlines.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1152,7 +1152,7 @@ pub fn manual_scan_link_url_2(input: &[u8]) -> Option<(&[u8], usize)> {
}
nb_p -= 1;
i += 1;
} else if isspace(input[i]) {
} else if isspace(input[i]) || input[i].is_ascii_control() {
if i == 0 {
return None;
}
Expand Down
8 changes: 8 additions & 0 deletions src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -553,6 +553,14 @@ fn reference_links() {
);
}

#[test]
fn no_control_characters_in_reference_links() {
html(
"[A]:\u{1b}\n\nX [A] Y\n",
"<p>[A]:\u{1b}</p>\n<p>X [A] Y</p>\n",
)
}

#[test]
fn link_entity_regression() {
html(
Expand Down

0 comments on commit 87c6483

Please sign in to comment.