it-tools/src/tools/safelink-decoder/safelink-decoder.service.ts
sharevb d3b32cc14e
feat(new tool): Outlook Safelink Decoder (#911)
* feat(new tool): Outlook Safelink Decoder

Fix #897

* Use native URL parsing

Co-authored-by: Corentin THOMASSET <corentin.thomasset74@gmail.com>

* Update src/tools/safelink-decoder/index.ts

---------

Co-authored-by: Corentin THOMASSET <corentin.thomasset74@gmail.com>
2024-03-11 10:19:32 +00:00

7 lines
247 B
TypeScript

export function decodeSafeLinksURL(safeLinksUrl: string) {
if (!safeLinksUrl.match(/\.safelinks\.protection\.outlook\.com/)) {
throw new Error('Invalid SafeLinks URL provided');
}
return new URL(safeLinksUrl).searchParams.get('url');
}