diff --git a/src/services/sanitize_attribute_name.ts b/src/services/sanitize_attribute_name.ts index 075ccfd03..b1f0e6579 100644 --- a/src/services/sanitize_attribute_name.ts +++ b/src/services/sanitize_attribute_name.ts @@ -1,13 +1,8 @@ export default function sanitizeAttributeName(origName: string) { - let fixedName: string; - - if (origName === '') { - fixedName = "unnamed"; - } - else { + const fixedName = (origName === '') + ? "unnamed" + : origName.replace(/[^\p{L}\p{N}_:]/ug, "_"); // any not allowed character should be replaced with underscore - fixedName = origName.replace(/[^\p{L}\p{N}_:]/ug, "_"); - } return fixedName; } \ No newline at end of file