fix end link crashes once and for all!
This commit is contained in:
parent
f851c569f9
commit
0c7efa315f
1 changed files with 3 additions and 2 deletions
|
@ -216,9 +216,10 @@ fn preprocess(string: String) -> String {
|
|||
let start_delims = vec![b'(', b'<'];
|
||||
let end_delims = vec![b')', b'>'];
|
||||
let links = finder.links(result.as_str()).filter(|link| {
|
||||
(link.start() == 0 || link.end() == result.len() - 1)
|
||||
// link.end() is the first char AFTER the link!
|
||||
(link.start() == 0 || link.end() == result.len())
|
||||
|| (!start_delims.contains(&result_vec[link.start() - 1])
|
||||
&& !end_delims.contains(&result_vec[link.end() + 1]))
|
||||
&& !end_delims.contains(&result_vec[link.end()]))
|
||||
});
|
||||
|
||||
let mut offset = 0;
|
||||
|
|
Loading…
Reference in a new issue