Skip to content

Commit 3296f90

Browse files
committed
enhance: only show two chars when they are all ascii letters or digits (#585)
1 parent a5e783d commit 3296f90

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

src/Views/Avatar.cs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -128,10 +128,9 @@ private static string GetFallbackString(string name)
128128
foreach (var part in parts)
129129
chars.Add(part[0]);
130130

131-
if (chars.Count >= 2)
131+
if (chars.Count >= 2 && char.IsAsciiLetterOrDigit(chars[0]) && char.IsAsciiLetterOrDigit(chars[^1]))
132132
return string.Format("{0}{1}", chars[0], chars[^1]);
133-
if (chars.Count == 1)
134-
return string.Format("{0}", chars[0]);
133+
135134
return name.Substring(0, 1);
136135
}
137136

0 commit comments

Comments
 (0)