it-tools/src/tools/safelink-decoder/safelink-decoder.service.ts

8 lines
247 B
TypeScript
Raw Normal View History

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');
}