8 lines
353 B
TypeScript
8 lines
353 B
TypeScript
// Path interno sicuro per il redirect post-login: deve iniziare con "/", non essere
|
|
// protocol-relative ("//"), non puntare alle API. Tutto il resto → home.
|
|
export function safeNext(next: string | null): string {
|
|
if (!next || !next.startsWith('/') || next.startsWith('//')) return '/';
|
|
if (next.startsWith('/api/')) return '/';
|
|
return next;
|
|
}
|