This repository was archived by the owner on Apr 26, 2024. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +6
-5
lines changed Expand file tree Collapse file tree 2 files changed +6
-5
lines changed Original file line number Diff line number Diff line change
1
+ Fix a long-standing bug where Synapse would count codepoints instead of bytes when validating the size of some fields.
Original file line number Diff line number Diff line change @@ -342,15 +342,15 @@ def check_state_dependent_auth_rules(
342
342
343
343
344
344
def _check_size_limits (event : "EventBase" ) -> None :
345
- if len (event .user_id ) > 255 :
345
+ if len (event .user_id . encode ( "utf-8" ) ) > 255 :
346
346
raise EventSizeError ("'user_id' too large" )
347
- if len (event .room_id ) > 255 :
347
+ if len (event .room_id . encode ( "utf-8" ) ) > 255 :
348
348
raise EventSizeError ("'room_id' too large" )
349
- if event .is_state () and len (event .state_key ) > 255 :
349
+ if event .is_state () and len (event .state_key . encode ( "utf-8" ) ) > 255 :
350
350
raise EventSizeError ("'state_key' too large" )
351
- if len (event .type ) > 255 :
351
+ if len (event .type . encode ( "utf-8" ) ) > 255 :
352
352
raise EventSizeError ("'type' too large" )
353
- if len (event .event_id ) > 255 :
353
+ if len (event .event_id . encode ( "utf-8" ) ) > 255 :
354
354
raise EventSizeError ("'event_id' too large" )
355
355
if len (encode_canonical_json (event .get_pdu_json ())) > MAX_PDU_SIZE :
356
356
raise EventSizeError ("event too large" )
You can’t perform that action at this time.
0 commit comments