Replace windows illegal filename characters with '_'.

This commit is contained in:
Peter 2024-06-27 02:22:35 +08:00
parent bf96b9f97b
commit 0ff76556a2

View File

@ -43,7 +43,10 @@
}
function sanitizeFileName(name) {
const sanitized = name.replace(/[^\x00-\x7F]/g, "").replace(/\s+/g, "_");
const sanitized = name
.replace(/[^\x00-\x7F]/g, "")
.replace(/\s+/g, "_")
.replace(/[/\\?%*:|"<>]/g, "_"); // Remove illegal filename characters
return sanitized.substring(0, 16);
}