philomena-dev / philomena

Next-generation imageboard
GNU Affero General Public License v3.0
92 stars 37 forks source link

underscores not recognized as part of url #359

Closed mdashlw closed 1 week ago

mdashlw commented 1 month ago
image
liamwhite commented 1 month ago

filed as https://github.com/kivikakk/comrak/issues/479

liamwhite commented 1 week ago

It appears this can be addressed as follows:

diff --git a/src/parser/autolink.rs b/src/parser/autolink.rs
index ca377f3..c85e18b 100644
--- a/src/parser/autolink.rs
+++ b/src/parser/autolink.rs
@@ -169,7 +169,7 @@ fn is_valid_hostchar(ch: char) -> bool {
 fn autolink_delim(data: &[u8], mut link_end: usize, relaxed_autolinks: bool) -> usize {
     static LINK_END_ASSORTMENT: Lazy<[bool; 256]> = Lazy::new(|| {
         let mut sc = [false; 256];
-        for c in &[b'?', b'!', b'.', b',', b':', b'*', b'_', b'~', b'\'', b'"'] {
+        for c in &[b'?', b'!', b'.', b',', b':', b'*', b'~', b'\'', b'"'] {
             sc[*c as usize] = true;
         }
         sc