* @param {string} filename filename * @returns {string} sanitized filename
(filename)
| 331 | * @returns {string} sanitized filename |
| 332 | */ |
| 333 | function sanitizeFilename(filename) { |
| 334 | // Replace invalid filesystem characters with underscores |
| 335 | return filename |
| 336 | .replace(/[<>:"/\\|?*]/g, "_") |
| 337 | .replace(/[\u0000-\u001F\u0080-\u009F]/g, "_") |
| 338 | .replace(/^\.+/, "_") |
| 339 | .replace(/\.+$/, "_") |
| 340 | .replace(/\s+/g, "_") |
| 341 | .slice(0, 200); // Limit filename length |
| 342 | } |
| 343 | |
| 344 | /** |
| 345 | * @param {string} name name |
no test coverage detected