Skip to content
Snippets Groups Projects
Commit 1ea428a6 authored by David Byers's avatar David Byers
Browse files

Merge branch '10-add-barracuda-urls' into 'master'

Resolve "Add Barracuda URLs"

Closes #10

See merge request !11
parents d61fe9ad 17c78161
No related branches found
No related tags found
1 merge request!11Resolve "Add Barracuda URLs"
Pipeline #38502 passed
...@@ -196,6 +196,9 @@ build:firefox:beta: ...@@ -196,6 +196,9 @@ build:firefox:beta:
- firefox/**/* - firefox/**/*
when: always when: always
- when: never - when: never
artifacts:
paths:
- safelinks-cleaner-firefox-beta.xpi
build:firefox:release: build:firefox:release:
stage: build stage: build
......
...@@ -23,11 +23,20 @@ ...@@ -23,11 +23,20 @@
/** /**
* Regexp that matches safe links. The original URL must be collected * List of regexps that match safe links. The original URL must be
* in match group 1. * collected in match group 1.
*/ */
const safelinksRegexp = new RegExp( const regexpList = [
'https?://[^.]+[.]safelinks[.]protection[.]outlook[.]com/[?]url=([^&]+)&.*', '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' 'gi'
); );
...@@ -51,9 +60,10 @@ const safelinksPopupVisibleClass = 'safelinks-cleaner-thunderbird-popup-visible' ...@@ -51,9 +60,10 @@ const safelinksPopupVisibleClass = 'safelinks-cleaner-thunderbird-popup-visible'
*/ */
function untangleLink(link) { function untangleLink(link) {
return link.replaceAll( return link.replaceAll(
safelinksRegexp, (match, url) => { safelinksRegexp,
(match, ...url) => {
try { try {
return decodeURIComponent(url); return decodeURIComponent(url.find((el) => el));
} }
catch (e) { catch (e) {
return url; return url;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment