From acadf0289e970263fda813ae33c8653297e08a56 Mon Sep 17 00:00:00 2001 From: Dessalines Date: Wed, 10 Feb 2021 10:36:22 -0500 Subject: [PATCH] Fixing reason lengths to char counts. --- crates/api/src/comment.rs | 2 +- crates/api/src/post.rs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) 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()); } -- 2.44.1