@@ -523,20 +523,21 @@ func GetUserSalt() (string, error) {
523
523
// Note: The set of characters here can safely expand without a breaking change,
524
524
// but characters removed from this set can cause user account linking to break
525
525
var (
526
- removeCharsRE = regexp .MustCompile (`['\x60]` )
526
+ customCharsReplacement = strings .NewReplacer ("Æ" , "AE" )
527
+ removeCharsRE = regexp .MustCompile (`['´\x60]` )
527
528
removeDiacriticsTransform = transform .Chain (norm .NFD , runes .Remove (runes .In (unicode .Mn )), norm .NFC )
528
- replaceCharsRE = regexp .MustCompile (`[\s, ]` )
529
+ replaceCharsHyphenRE = regexp .MustCompile (`[\s~+ ]` )
529
530
)
530
531
531
532
// normalizeUserName returns a string with single-quotes and diacritics
532
533
// removed, and any other non-supported username characters replaced with
533
534
// a `-` character
534
535
func NormalizeUserName (s string ) (string , error ) {
535
- strDiacriticsRemoved , n , err := transform .String (removeDiacriticsTransform , s )
536
+ strDiacriticsRemoved , n , err := transform .String (removeDiacriticsTransform , customCharsReplacement . Replace ( s ) )
536
537
if err != nil {
537
538
return "" , fmt .Errorf ("Failed to normalize character `%v` in provided username `%v`" , s [n ], s )
538
539
}
539
- return replaceCharsRE .ReplaceAllLiteralString (removeCharsRE .ReplaceAllLiteralString (strDiacriticsRemoved , "" ), "-" ), nil
540
+ return replaceCharsHyphenRE .ReplaceAllLiteralString (removeCharsRE .ReplaceAllLiteralString (strDiacriticsRemoved , "" ), "-" ), nil
540
541
}
541
542
542
543
var (
0 commit comments