Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
synapse
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Terraform modules
Monitor
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Timo Ley
synapse
Commits
7bb3673f
Unverified
Commit
7bb3673f
authored
3 years ago
by
Andrew Morgan
Committed by
GitHub
3 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Ease searching for M_TOO_LARGE-related error codes (#10750)
parent
e1641b46
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
changelog.d/10750.misc
+1
-0
1 addition, 0 deletions
changelog.d/10750.misc
synapse/event_auth.py
+6
-9
6 additions, 9 deletions
synapse/event_auth.py
with
7 additions
and
9 deletions
changelog.d/10750.misc
0 → 100644
+
1
−
0
View file @
7bb3673f
Refactor event size checking code to simplify searching the codebase for the origins of certain error strings that are occasionally emitted.
\ No newline at end of file
This diff is collapsed.
Click to expand it.
synapse/event_auth.py
+
6
−
9
View file @
7bb3673f
...
@@ -216,21 +216,18 @@ def check(
...
@@ -216,21 +216,18 @@ def check(
def
_check_size_limits
(
event
:
EventBase
)
->
None
:
def
_check_size_limits
(
event
:
EventBase
)
->
None
:
def
too_big
(
field
):
raise
EventSizeError
(
"
%s too large
"
%
(
field
,))
if
len
(
event
.
user_id
)
>
255
:
if
len
(
event
.
user_id
)
>
255
:
too_big
(
"
user_id
"
)
raise
EventSizeError
(
"
'
user_id
'
too large
"
)
if
len
(
event
.
room_id
)
>
255
:
if
len
(
event
.
room_id
)
>
255
:
too_big
(
"
room_id
"
)
raise
EventSizeError
(
"
'
room_id
'
too large
"
)
if
event
.
is_state
()
and
len
(
event
.
state_key
)
>
255
:
if
event
.
is_state
()
and
len
(
event
.
state_key
)
>
255
:
too_big
(
"
state_key
"
)
raise
EventSizeError
(
"
'
state_key
'
too large
"
)
if
len
(
event
.
type
)
>
255
:
if
len
(
event
.
type
)
>
255
:
too_big
(
"
type
"
)
raise
EventSizeError
(
"
'
type
'
too large
"
)
if
len
(
event
.
event_id
)
>
255
:
if
len
(
event
.
event_id
)
>
255
:
too_big
(
"
event_id
"
)
raise
EventSizeError
(
"
'
event_id
'
too large
"
)
if
len
(
encode_canonical_json
(
event
.
get_pdu_json
()))
>
MAX_PDU_SIZE
:
if
len
(
encode_canonical_json
(
event
.
get_pdu_json
()))
>
MAX_PDU_SIZE
:
too_big
(
"
event
"
)
raise
EventSizeError
(
"
event too large
"
)
def
_can_federate
(
event
:
EventBase
,
auth_events
:
StateMap
[
EventBase
])
->
bool
:
def
_can_federate
(
event
:
EventBase
,
auth_events
:
StateMap
[
EventBase
])
->
bool
:
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment