diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 777d5100223626e1d44fddfb01bc32ae7fd8843d..34792f3b4f97671cc3973464ade7d47582928fdf 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -196,6 +196,9 @@ build:firefox:beta: - firefox/**/* when: always - when: never + artifacts: + paths: + - safelinks-cleaner-firefox-beta.xpi build:firefox:release: stage: build diff --git a/shared/links.js b/shared/links.js index a3e65891a846f1de1eaccf2274d7e40f0f0e103e..3c817b123845a990de6a0622345e21486824fd3d 100644 --- a/shared/links.js +++ b/shared/links.js @@ -23,11 +23,20 @@ /** - * Regexp that matches safe links. The original URL must be collected - * in match group 1. + * List of regexps that match safe links. The original URL must be + * collected in match group 1. */ -const safelinksRegexp = new RegExp( +const regexpList = [ 'https?://[^.]+[.]safelinks[.]protection[.]outlook[.]com/[?]url=([^&]+)&.*', + 'https?://linkprotect[.]cudasvc[.]com/url[?]a=([^&]+)&.*' +]; + + +/** + * Concatenated regexp for all safe links types. + */ +const safelinksRegexp = new RegExp( + '(?:' + regexpList.map((string) => '(?:' + string + ')').join('|') + ')', 'gi' ); @@ -51,9 +60,10 @@ const safelinksPopupVisibleClass = 'safelinks-cleaner-thunderbird-popup-visible' */ function untangleLink(link) { return link.replaceAll( - safelinksRegexp, (match, url) => { + safelinksRegexp, + (match, ...url) => { try { - return decodeURIComponent(url); + return decodeURIComponent(url.find((el) => el)); } catch (e) { return url;