mirror of
https://forgejo.ellis.link/continuwuation/continuwuity.git
synced 2026-11-12 19:56:48 +00:00
fix: Return M_KEY_TOO_LARGE for oversize profile keys
Profile keys longer than 255 bytes were rejected with 413 M_TOO_LARGE. The spec requires 400 M_KEY_TOO_LARGE, which ruma now provides.
This commit is contained in:
1 parent
dad9e1426c
commit
42609eab02
2 files changed
+2
-5
No files matched your search
@@ -0,0 +1 @@
|
||||
Setting a profile key longer than 255 bytes now returns 400 `M_KEY_TOO_LARGE` as required by the spec, instead of 413 `M_TOO_LARGE`.
|
||||
@@ -51,12 +51,8 @@ impl super::Service {
|
||||
|
||||
let field_name = change.field_name();
|
||||
|
||||
// TODO: The spec mentions special error codes (M_PROFILE_TOO_LARGE,
|
||||
// M_KEY_TOO_LARGE) for profile field size limits, but they're not in
|
||||
// its list of error codes and Ruma doesn't have them. Should we
|
||||
// return those, or is M_TOO_LARGE okay?
|
||||
if field_name.as_str().len() > MAX_KEY_LENGTH_BYTES {
|
||||
return Err!(Request(TooLarge(
|
||||
return Err!(Request(KeyTooLarge(
|
||||
"Individual profile keys must not exceed {MAX_KEY_LENGTH_BYTES} bytes in length."
|
||||
)));
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user