fix sanitizeId

This commit is contained in:
Risenafis 2024-06-25 22:23:55 +09:00
parent 0f00adca0c
commit 0276a2ef71
1 changed files with 1 additions and 1 deletions

View File

@ -915,7 +915,7 @@ function getCharacters(unrestricted) {
function sanitizeId(input) {
// Remove any non-alphanumeric characters except underscore (_) and hyphen (-)
let sanitized = input.replace(/[^a-zA-Z0-9-_]/g, '');
let sanitized = encodeURIComponent(input).replace(/[^a-zA-Z0-9-_]/g, '');
// Ensure first character is always a letter
if (!/^[a-zA-Z]/.test(sanitized)) {