debut refacto

This commit is contained in:
Tom Boullay
2026-04-14 14:18:40 +02:00
parent ab9685b6ee
commit e9ae6ffc41
13 changed files with 721 additions and 554 deletions
+12
View File
@@ -0,0 +1,12 @@
import { basename } from 'path'
/**
* Sanitize a filename: strip path components, replace special chars,
* collapse underscores, lowercase.
*/
export function sanitizeFilename(name: string): string {
return basename(name)
.replace(/[^a-zA-Z0-9._-]/g, '_')
.replace(/_{2,}/g, '_')
.toLowerCase()
}