]> Untitled Git - lemmy.git/commitdiff
Fixing reason lengths to char counts.
authorDessalines <tyhou13@gmx.com>
Wed, 10 Feb 2021 15:36:22 +0000 (10:36 -0500)
committerDessalines <tyhou13@gmx.com>
Wed, 10 Feb 2021 15:36:22 +0000 (10:36 -0500)
crates/api/src/comment.rs
crates/api/src/post.rs

index 5d798d1daeaa21b296d5c9898da55428ec647432..b77e4151a6a0a6ec9ffa1e736f8cd75f2b7b1509 100644 (file)
@@ -672,7 +672,7 @@ impl Perform for CreateCommentReport {
     if reason.is_empty() {
       return Err(APIError::err("report_reason_required").into());
     }
-    if reason.len() > 1000 {
+    if reason.chars().count() > 1000 {
       return Err(APIError::err("report_too_long").into());
     }
 
index 5ab461dc1f3bcac67035876462c63ab0df943aa0..7c7afe604446c3b9a3867f5f9e2eb5d43ac6a810 100644 (file)
@@ -749,7 +749,7 @@ impl Perform for CreatePostReport {
     if reason.is_empty() {
       return Err(APIError::err("report_reason_required").into());
     }
-    if reason.len() > 1000 {
+    if reason.chars().count() > 1000 {
       return Err(APIError::err("report_too_long").into());
     }