Skip to content

Commit

Permalink
Handle file:// links in identify text
Browse files Browse the repository at this point in the history
Fixes #29879
  • Loading branch information
elpaso committed May 27, 2019
1 parent d64282d commit a33ab6f
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/core/qgsstringutils.cpp
Expand Up @@ -414,7 +414,7 @@ QString QgsStringUtils::insertLinks( const QString &string, bool *foundLinks )
// http://alanstorm.com/url_regex_explained
// note - there's more robust implementations available, but we need one which works within the limitation of QRegExp
static QRegExp urlRegEx( "(\\b(([\\w-]+://?|www[.])[^\\s()<>]+(?:\\([\\w\\d]+\\)|([^!\"#$%&'()*+,\\-./:;<=>?@[\\\\\\]^_`{|}~\\s]|/))))" );
static QRegExp protoRegEx( "^(?:f|ht)tps?://" );
static QRegExp protoRegEx( "^(?:f|ht)tps?://|file://" );
static QRegExp emailRegEx( "([\\w._%+-]+@[\\w.-]+\\.[A-Za-z]+)" );

int offset = 0;
Expand Down
2 changes: 2 additions & 0 deletions tests/src/core/testqgsstringutils.cpp
Expand Up @@ -159,6 +159,8 @@ void TestQgsStringUtils::insertLinks()
QVERIFY( found );
QCOMPARE( QgsStringUtils::insertLinks( QString( "is a@a an email?" ), &found ), QString( "is a@a an email?" ) );
QVERIFY( !found );
QCOMPARE( QgsStringUtils::insertLinks( QString( "Load file:///this/is/path/to.file?query=1#anchor" ), &found ), QString( "Load <a href=\"file:///this/is/path/to.file?query=1#anchor\">file:///this/is/path/to.file?query=1#anchor</a>" ) );
QVERIFY( found );
}

void TestQgsStringUtils::titleCase_data()
Expand Down

0 comments on commit a33ab6f

Please sign in to comment.