From c23c15e5126bd942c4aba6a35d99e4b705b53b83 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakub=20Pie=C5=84kowski?= <4557247-Jakski@users.noreply.gitlab.com> Date: Thu, 3 Jul 2025 23:07:57 +0000 Subject: [PATCH] fix: Respond with HTTP code 413, when request size is too big --- src/api/ruma_wrapper/axum.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/api/ruma_wrapper/axum.rs b/src/api/ruma_wrapper/axum.rs index f061856f..73a75b3d 100644 --- a/src/api/ruma_wrapper/axum.rs +++ b/src/api/ruma_wrapper/axum.rs @@ -60,7 +60,11 @@ where ) .await .map_err(|err| { - if std::error::Error::source(&err).as_ref().and_then(|err| std::error::Error::source(err)).is_some() { + if std::error::Error::source(&err) + .as_ref() + .and_then(|err| std::error::Error::source(err)) + .is_some_and(|err| err.is::()) + { Error::BadRequest(ErrorKind::TooLarge, "Reached maximum request size") } else { Error::BadRequest(ErrorKind::Unknown, "An unknown error has occurred")