fix sanitizeId
This commit is contained in:
parent
0f00adca0c
commit
0276a2ef71
|
@ -915,7 +915,7 @@ function getCharacters(unrestricted) {
|
||||||
|
|
||||||
function sanitizeId(input) {
|
function sanitizeId(input) {
|
||||||
// Remove any non-alphanumeric characters except underscore (_) and hyphen (-)
|
// 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
|
// Ensure first character is always a letter
|
||||||
if (!/^[a-zA-Z]/.test(sanitized)) {
|
if (!/^[a-zA-Z]/.test(sanitized)) {
|
||||||
|
|
Loading…
Reference in New Issue