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 <ronald@barend.se>

---------

Co-authored-by: Ronald Barendse <ronald@barend.se>
This commit is contained in:
Erik-Jan Westendorp
2023-02-08 12:47:46 +01:00
committed by GitHub
parent 559e56949f
commit 280fbdd870

View File

@@ -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) {