diff --git a/quotesdb/src/bin/api/db/d1.rs b/quotesdb/src/bin/api/db/d1.rs index f28e571..20363c5 100644 --- a/quotesdb/src/bin/api/db/d1.rs +++ b/quotesdb/src/bin/api/db/d1.rs @@ -684,17 +684,12 @@ impl QuoteRepository for D1Repository { /// with the given `quote_id` exists. async fn create_report(&self, quote_id: &str, reason: Option<&str>) -> Result<(), DbError> { // Step 1: verify the quote exists. - #[derive(serde::Deserialize)] - struct ExistsRow { - count: i64, - } - let exists_row = self .db .prepare("SELECT COUNT(*) AS count FROM quotes WHERE id = ?1") .bind(&[JsValue::from_str(quote_id)]) .map_err(|e| DbError::Internal(e.to_string()))? - .first::(None) + .first::(None) .await .map_err(|e| DbError::Internal(e.to_string()))?; diff --git a/quotesdb/src/bin/api/handlers/mod.rs b/quotesdb/src/bin/api/handlers/mod.rs index 733d8c6..21bbc07 100644 --- a/quotesdb/src/bin/api/handlers/mod.rs +++ b/quotesdb/src/bin/api/handlers/mod.rs @@ -565,7 +565,7 @@ async fn report_handler( let reason = body.and_then(|Json(input)| input.reason); // Validate reason length — enforced here before the DB call. - if reason.as_deref().map(|r| r.len()).unwrap_or(0) > 256 { + if reason.as_deref().map(|r| r.chars().count()).unwrap_or(0) > 256 { return error_response( StatusCode::BAD_REQUEST, "reason must be at most 256 characters",