From 3ecfc53a7061dce077188ab0b28a1d23ae4a2e6e Mon Sep 17 00:00:00 2001 From: Trevor Williams Date: Sat, 22 May 2021 13:31:39 -0500 Subject: [PATCH] Fixing parsing issue with files starting with file:// --- src/parsers/UrlParser.vala | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/parsers/UrlParser.vala b/src/parsers/UrlParser.vala index 7c0a8ce2..a979d00c 100644 --- a/src/parsers/UrlParser.vala +++ b/src/parsers/UrlParser.vala @@ -39,7 +39,11 @@ public class UrlParser : TextParser { /* Add the URL filepath if the matched text is a valid file path */ private void highlight_filepath( FormattedText text, MatchInfo match ) { - if( FileUtils.test( match.fetch( 0 ), FileTest.EXISTS ) ) { + var str = match.fetch( 0 ); + if( str.substring( 0, 7 ) == "file://" ) { + str = str.substring( 7 ); + } + if( FileUtils.test( str, FileTest.EXISTS ) ) { add_tag( text, match, 0, FormatTag.URL, get_text( match, 0 ) ); } }