Skip to content

Commit

Permalink
Fixing parsing issue with files starting with file://
Browse files Browse the repository at this point in the history
  • Loading branch information
phase1geo committed May 22, 2021
1 parent 9301433 commit 3ecfc53
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/parsers/UrlParser.vala
Original file line number Diff line number Diff line change
Expand Up @@ -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 ) );
}
}
Expand Down

0 comments on commit 3ecfc53

Please sign in to comment.