diff options
author | Marvin W <git@larma.de> | 2020-04-22 23:58:02 +0200 |
---|---|---|
committer | Marvin W <git@larma.de> | 2020-04-22 23:58:02 +0200 |
commit | 204455afd21ed6a11f02a98d1e15c0a02c58c027 (patch) | |
tree | f32f46b54dccea874f23e25332f6bbd33745fcb3 | |
parent | caad5ff763bc35e749b6372618f78580acb8682d (diff) | |
download | dino-204455afd21ed6a11f02a98d1e15c0a02c58c027.tar.gz dino-204455afd21ed6a11f02a98d1e15c0a02c58c027.zip |
Fix rare issue with incorrect link parsing
-rw-r--r-- | main/src/ui/util/helper.vala | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/main/src/ui/util/helper.vala b/main/src/ui/util/helper.vala index 65318870..d5b5a2bb 100644 --- a/main/src/ui/util/helper.vala +++ b/main/src/ui/util/helper.vala @@ -281,10 +281,10 @@ public static string parse_add_markup(string s_, string? highlight_word, bool pa string s = s_; bool already_escaped = already_escaped_; - if (parse_links) { + if (parse_links && !already_escaped) { MatchInfo match_info; get_url_regex().match(s.down(), 0, out match_info); - if (match_info.matches()) { + while (match_info.matches()) { int start, end; match_info.fetch_pos(0, out start, out end); string link = s[start:end]; @@ -325,6 +325,7 @@ public static string parse_add_markup(string s_, string? highlight_word, bool pa "<a href=\"" + Markup.escape_text(link) + "\">" + parse_add_markup(link, highlight_word, false, false, already_escaped) + "</a>" + parse_add_markup(s[end:s.length], highlight_word, parse_links, parse_text_markup, already_escaped); } + match_info.next(); } } |