mirror of
https://github.com/pacnpal/thrilltrack-explorer.git
synced 2025-12-24 09:31:12 -05:00
Fix console statement violations
This commit is contained in:
@@ -6,6 +6,7 @@
|
||||
*/
|
||||
|
||||
import DOMPurify from 'dompurify';
|
||||
import { logger } from './logger';
|
||||
|
||||
/**
|
||||
* Sanitize HTML content to prevent XSS attacks
|
||||
@@ -39,14 +40,14 @@ export function sanitizeURL(url: string): string {
|
||||
const allowedProtocols = ['http:', 'https:', 'mailto:'];
|
||||
|
||||
if (!allowedProtocols.includes(parsed.protocol)) {
|
||||
console.warn(`Blocked potentially dangerous URL protocol: ${parsed.protocol}`);
|
||||
logger.warn('Blocked potentially dangerous URL protocol', { protocol: parsed.protocol });
|
||||
return '#';
|
||||
}
|
||||
|
||||
return url;
|
||||
} catch {
|
||||
// Invalid URL format
|
||||
console.warn(`Invalid URL format: ${url}`);
|
||||
logger.warn('Invalid URL format', { url });
|
||||
return '#';
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user