* 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>
		
			
				
	
	
		
			8 lines
		
	
	
		
			247 B
		
	
	
	
		
			TypeScript
		
	
	
	
	
	
			
		
		
	
	
			8 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');
 | |
| }
 |