From 280fbdd8706d74547b117d7a366cf35df247705d Mon Sep 17 00:00:00 2001 From: Erik-Jan Westendorp Date: Wed, 8 Feb 2023 12:47:46 +0100 Subject: [PATCH] Remove special characters in avatar [part 2] (#13796) * Update regex * Update src/Umbraco.Web.UI.Client/src/common/directives/components/umbavatar.directive.js Co-authored-by: Ronald Barendse --------- Co-authored-by: Ronald Barendse --- .../src/common/directives/components/umbavatar.directive.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Umbraco.Web.UI.Client/src/common/directives/components/umbavatar.directive.js b/src/Umbraco.Web.UI.Client/src/common/directives/components/umbavatar.directive.js index 2c561d3505..9ad475ad85 100644 --- a/src/Umbraco.Web.UI.Client/src/common/directives/components/umbavatar.directive.js +++ b/src/Umbraco.Web.UI.Client/src/common/directives/components/umbavatar.directive.js @@ -70,8 +70,8 @@ Use this directive to render an avatar. function getNameInitials(name) { if (name) { - const notAllowed = /[\[\]\{\}\*\?\&\$\@\!\(\)\%\#]+/g; - var names = name.replace(notAllowed,'').trim().split(' '), + const notAllowedRegex = /[^\p{Letter}\p{Number} ]+/gu; + var names = name.replace(notAllowedRegex, '').trim().split(' '), initials = names[0].substring(0, 1); if (names.length > 1) {