Skip to content
Snippets Groups Projects
Commit d009e190 authored by Anton Sarukhanov's avatar Anton Sarukhanov
Browse files

Handle links with arbitrary path.

Previously we assumed that ATP-rewritten links would have the querystring immediately after the domain.
This commit updates the regex to match links even if they have a path component.

Fixes #4.
parent f88c0eb0
No related branches found
No related tags found
No related merge requests found
...@@ -45,7 +45,7 @@ var unsafelinks = { ...@@ -45,7 +45,7 @@ var unsafelinks = {
}, },
// Regular expression matching a safelinks-encoded URL. // Regular expression matching a safelinks-encoded URL.
urlRegex: /https?:\/\/(?:.+?\.)?safelinks\.protection\.outlook\.com\/([A-Za-z0-9\-\._~:\/\?#\[\]@!$&'\(\)\*\+,;\=%]*)/gi, urlRegex: /https?:\/\/(?:.+?\.)?safelinks\.protection\.outlook\.com\/(?:[^\?]+)?([A-Za-z0-9\-\._~:\/\?#\[\]@!$&'\(\)\*\+,;\=%]*)/gi,
replacer: function(url, queryString){ replacer: function(url, queryString){
// Extract the "url" parameter from the URL, if it exists. // Extract the "url" parameter from the URL, if it exists.
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
"manifest_version": 2, "manifest_version": 2,
"name": "Un-Safelinks", "name": "Un-Safelinks",
"description": "Replace URLs which have been rewritten by Office 365 Advanced Threat Protection with the original URL.", "description": "Replace URLs which have been rewritten by Office 365 Advanced Threat Protection with the original URL.",
"version": "1.3.3", "version": "1.4",
"author": "Anton Sarukhanov", "author": "Anton Sarukhanov",
"homepage_url": "https://github.com/antsar/unsafelinks", "homepage_url": "https://github.com/antsar/unsafelinks",
"applications": { "applications": {
......
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