7211d74d3a
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
9 lines
400 B
TypeScript
9 lines
400 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.includes('\\')) return '/';
|
|
if (!next || !next.startsWith('/') || next.startsWith('//')) return '/';
|
|
if (next.startsWith('/api/')) return '/';
|
|
return next;
|
|
}
|