]> Untitled Git - lemmy.git/commitdiff
Fixing display name limit. Fixes #1421
authorDessalines <tyhou13@gmx.com>
Wed, 10 Feb 2021 15:27:48 +0000 (10:27 -0500)
committerDessalines <tyhou13@gmx.com>
Wed, 10 Feb 2021 15:27:48 +0000 (10:27 -0500)
crates/utils/src/utils.rs

index b2a7c97e267d3a04d243403c70d801ce262ec9e4..6297435689e1633b0a51d16ad3f8fa5cfbacb81b 100644 (file)
@@ -110,8 +110,8 @@ pub fn is_valid_username(name: &str) -> bool {
 // Can't do a regex here, reverse lookarounds not supported
 pub fn is_valid_preferred_username(preferred_username: &str) -> bool {
   !preferred_username.starts_with('@')
-    && preferred_username.len() >= 3
-    && preferred_username.len() <= 20
+    && preferred_username.chars().count() >= 3
+    && preferred_username.chars().count() <= 20
 }
 
 pub fn is_valid_community_name(name: &str) -> bool {