fix(clean_url): extract domain from sophos

closes #92
This commit is contained in:
MDLeom 2025-03-23 03:25:26 +00:00
parent de74a0b373
commit ae74714f38
No known key found for this signature in database
GPG Key ID: 32D3E28E96A695E8
1 changed files with 5 additions and 2 deletions

View File

@ -39,11 +39,14 @@ for await (const line of createInterface({ input: process.stdin, terminal: false
if (URL.canParse(line)) {
let url = new URL(line)
// Decode O365 Safelinks
// https://support.microsoft.com/en-us/office/advanced-outlook-com-security-for-microsoft-365-subscribers-882d2243-eab9-4545-a58a-b36fee4a46e2
// O365 Safelinks
if (url.hostname.endsWith('safelinks.protection.outlook.com')) {
url = new URL(url.searchParams.get('url'))
}
// #92
if (url.hostname.endsWith('.protection.sophos.com')) {
url = new URL(`http://${url.searchParams.get('d')}`)
}
url.host = url.host.replace(/^www\./, '')