From: Dessalines Date: Wed, 10 Feb 2021 15:36:22 +0000 (-0500) Subject: Fixing reason lengths to char counts. X-Git-Url: http://these/git/%22%7Burl%7D/%22https:/image.com/%22?a=commitdiff_plain;h=acadf0289e970263fda813ae33c8653297e08a56;p=lemmy.git Fixing reason lengths to char counts. --- diff --git a/crates/api/src/comment.rs b/crates/api/src/comment.rs index 5d798d1d..b77e4151 100644 --- a/crates/api/src/comment.rs +++ b/crates/api/src/comment.rs @@ -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()); } diff --git a/crates/api/src/post.rs b/crates/api/src/post.rs index 5ab461dc..7c7afe60 100644 --- a/crates/api/src/post.rs +++ b/crates/api/src/post.rs @@ -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()); }