util: Handle trailing LTR/RTL markers in URLs

Some electron apps apparently spread those generously over their
notification text, so may sure to not include them accidentally
in URLs.

https://gitlab.gnome.org/GNOME/gnome-shell/issues/1614
This commit is contained in:
Florian Müllner
2019-09-14 00:03:02 +02:00
committed by Georges Basile Stavracas Neto
parent efed695eca
commit 252e694979
2 changed files with 3 additions and 1 deletions

View File

@ -14,7 +14,7 @@ var SCROLL_TIME = 100;
// http://daringfireball.net/2010/07/improved_regex_for_matching_urls
const _balancedParens = '\\([^\\s()<>]+\\)';
const _leadingJunk = '[\\s`(\\[{\'\\"<\u00AB\u201C\u2018]';
const _notTrailingJunk = '[^\\s`!()\\[\\]{};:\'\\".,<>?\u00AB\u00BB\u201C\u201D\u2018\u2019]';
const _notTrailingJunk = '[^\\s`!()\\[\\]{};:\'\\".,<>?\u00AB\u00BB\u200E\u200F\u201C\u201D\u2018\u2019\u202A\u202C]';
const _urlRegexp = new RegExp(
`(^|${_leadingJunk})` +