Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

disable control characters in link definitions #219

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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