Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
safelinks-cleaner
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Terraform modules
Analyze
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
safelinks
safelinks-cleaner
Commits
88af7e12
Commit
88af7e12
authored
3 years ago
by
David Byers
Browse files
Options
Downloads
Patches
Plain Diff
Added docstrings, updated messages.
parent
3b9f5166
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!13
Added docstrings, updated messages.
Pipeline
#38640
passed
3 years ago
Stage: prepare
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
shared/_locales/en/messages.json
+1
-1
1 addition, 1 deletion
shared/_locales/en/messages.json
shared/_locales/sv/messages.json
+1
-1
1 addition, 1 deletion
shared/_locales/sv/messages.json
shared/patterns.js
+30
-0
30 additions, 0 deletions
shared/patterns.js
with
32 additions
and
2 deletions
shared/_locales/en/messages.json
+
1
−
1
View file @
88af7e12
{
"extensionDescription"
:
{
"message"
:
"Correct the display and quoting of links mangled by Microsoft Defender for Office 365 Safe Links."
,
"message"
:
"Correct the display and quoting of links mangled by Microsoft Defender for Office 365 Safe Links
or Barracuda Link Protection
."
,
"description"
:
"Description of the extension."
},
...
...
This diff is collapsed.
Click to expand it.
shared/_locales/sv/messages.json
+
1
−
1
View file @
88af7e12
{
"extensionDescription"
:
{
"message"
:
"Korrigera visning och citering av länkar manglade av Microsoft Defender för Office 365 Safe Links."
,
"message"
:
"Korrigera visning och citering av länkar manglade av Microsoft Defender för Office 365 Safe Links
eller Barracuda Link Protection
."
,
"description"
:
"Description of the extension."
},
...
...
This diff is collapsed.
Click to expand it.
shared/patterns.js
+
30
−
0
View file @
88af7e12
...
...
@@ -25,23 +25,52 @@
const
safelinksPatterns
=
[
{
name
:
'
Microsoft Defender For Office 365 Safe Links
'
,
host
:
'
*.safelinks.protection.outlook.com
'
,
path
:
'
[?]url=([^&]+).*
'
},
{
name
:
'
Barracuda Link Protection
'
,
host
:
'
linkprotect.cudasvc.com
'
,
path
:
'
url[?]a=([^&]+).*
'
},
{
name
:
'
Proofpoint (v3)
'
,
host
:
'
urldefense.com
'
,
path
:
'
v3/_+([^_]+).*
'
}
// {
// name: 'Proofpoint (v2)',
// host: 'urldefense.proofpoint.com',
// path: 'v2/url[?]u=([^&]+).*',
// proc: (string) => string.replace('_', '/')
// }
];
/**
* Compute a list of url patterns from the link patterns.
* @returns {Array} - Array of patterns.
*/
function
computeSafelinksMatchPatterns
()
{
return
safelinksPatterns
.
map
(({
host
,
path
})
=>
'
*://
'
+
host
+
'
/*
'
);
}
/**
* Escape a hostname pattern for use in a regexp.
* @param {string} host - The host name pattern.
* @returns {string} A suitable regexp.
*/
function
escapeHostname
(
host
)
{
return
host
.
replace
(
'
.
'
,
'
[.]
'
).
replace
(
'
*
'
,
'
[^/]*
'
)
}
/**
* Compute a regexp that matches all mangled links.
* @returns {RegExp} A regexp that matches all possible mangled links.
*/
function
computeSafelinksRegexp
()
{
return
new
RegExp
(
'
(?:
'
+
safelinksPatterns
.
map
(
...
...
@@ -51,4 +80,5 @@ function computeSafelinksRegexp() {
'
gi
'
);
}
const
safelinksRegexp
=
computeSafelinksRegexp
()
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment