fix: Return M_PROFILE_TOO_LARGE for oversize profiles

Profile updates that would push the profile over 64 KiB were rejected
with an untyped error, producing a 500. The spec requires 400
M_PROFILE_TOO_LARGE, which ruma now provides.
This commit is contained in:
Bardi Harborow authored and Ellis Git committed 2026-11-04 19:32:17 +00:00
1 parent 42609eab02
commit 4d0ccd998f
2 files changed
+3 -2

No files matched your search

+1
View File
@@ -0,0 +1 @@
Setting profile data that would make the profile exceed 64 KiB now returns 400 `M_PROFILE_TOO_LARGE` as required by the spec, instead of a 500 error.
+2 -2
View File
@@ -80,10 +80,10 @@ impl super::Service {
.len()
> MAX_PROFILE_LENGTH_BYTES
{
return Err!(
return Err!(Request(ProfileTooLarge(
"Profile data must not exceed {MAX_PROFILE_LENGTH_BYTES} bytes in \
length."
);
)));
}
} else {
return Err!(Request(BadJson("Failed to canonicalize profile.")));