mirror of
https://forgejo.ellis.link/continuwuation/continuwuity.git
synced 2026-05-26 20:49:55 +00:00
fix: Increase max length for report reasons
This commit is contained in:
+14
-12
@@ -25,6 +25,8 @@ struct Report {
|
|||||||
reason: String,
|
reason: String,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const MAX_REASON_LENGTH: usize = 2000;
|
||||||
|
|
||||||
/// # `POST /_matrix/client/v3/rooms/{roomId}/report`
|
/// # `POST /_matrix/client/v3/rooms/{roomId}/report`
|
||||||
///
|
///
|
||||||
/// Reports an abusive room to homeserver admins
|
/// Reports an abusive room to homeserver admins
|
||||||
@@ -39,10 +41,10 @@ pub(crate) async fn report_room_route(
|
|||||||
return Err!(Request(UserSuspended("You cannot perform this action while suspended.")));
|
return Err!(Request(UserSuspended("You cannot perform this action while suspended.")));
|
||||||
}
|
}
|
||||||
|
|
||||||
if body.reason.len() > 750 {
|
if body.reason.len() > MAX_REASON_LENGTH {
|
||||||
return Err!(Request(
|
return Err!(Request(InvalidParam(
|
||||||
InvalidParam("Reason too long, should be 750 characters or fewer",)
|
"Reason too long, should be {MAX_REASON_LENGTH} bytes or fewer",
|
||||||
));
|
)));
|
||||||
}
|
}
|
||||||
|
|
||||||
delay_response().await;
|
delay_response().await;
|
||||||
@@ -139,10 +141,10 @@ pub(crate) async fn report_user_route(
|
|||||||
return Err!(Request(UserSuspended("You cannot perform this action while suspended.")));
|
return Err!(Request(UserSuspended("You cannot perform this action while suspended.")));
|
||||||
}
|
}
|
||||||
|
|
||||||
if body.reason.len() > 750 {
|
if body.reason.len() > MAX_REASON_LENGTH {
|
||||||
return Err!(Request(
|
return Err!(Request(InvalidParam(
|
||||||
InvalidParam("Reason too long, should be 750 characters or fewer",)
|
"Reason too long, should be {MAX_REASON_LENGTH} bytes or fewer",
|
||||||
));
|
)));
|
||||||
}
|
}
|
||||||
|
|
||||||
delay_response().await;
|
delay_response().await;
|
||||||
@@ -194,10 +196,10 @@ async fn is_event_report_valid(
|
|||||||
return Err!(Request(NotFound("Event ID does not belong to the reported room",)));
|
return Err!(Request(NotFound("Event ID does not belong to the reported room",)));
|
||||||
}
|
}
|
||||||
|
|
||||||
if reason.len() > 750 {
|
if reason.len() > MAX_REASON_LENGTH {
|
||||||
return Err!(Request(
|
return Err!(Request(InvalidParam(
|
||||||
InvalidParam("Reason too long, should be 750 characters or fewer",)
|
"Reason too long, should be {MAX_REASON_LENGTH} bytes or fewer",
|
||||||
));
|
)));
|
||||||
}
|
}
|
||||||
|
|
||||||
if !services
|
if !services
|
||||||
|
|||||||
Reference in New Issue
Block a user