Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Matrix
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Container Registry
Model registry
Operate
Environments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
TeDomum
Matrix
Commits
302dc89f
Unverified
Commit
302dc89f
authored
4 years ago
by
Richard van der Hoff
Committed by
GitHub
4 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Fix bug which caused failure on join with malformed membership events (#8385)
parent
cbabb312
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
changelog.d/8385.bugfix
+1
-0
1 addition, 0 deletions
changelog.d/8385.bugfix
synapse/storage/databases/main/events.py
+7
-3
7 additions, 3 deletions
synapse/storage/databases/main/events.py
with
8 additions
and
3 deletions
changelog.d/8385.bugfix
0 → 100644
+
1
−
0
View file @
302dc89f
Fix a bug which could cause errors in rooms with malformed membership events, on servers using sqlite.
This diff is collapsed.
Click to expand it.
synapse/storage/databases/main/events.py
+
7
−
3
View file @
302dc89f
...
...
@@ -17,7 +17,7 @@
import
itertools
import
logging
from
collections
import
OrderedDict
,
namedtuple
from
typing
import
TYPE_CHECKING
,
Dict
,
Iterable
,
List
,
Set
,
Tuple
from
typing
import
TYPE_CHECKING
,
Any
,
Dict
,
Iterable
,
List
,
Optional
,
Set
,
Tuple
import
attr
from
prometheus_client
import
Counter
...
...
@@ -1108,6 +1108,10 @@ class PersistEventsStore:
def
_store_room_members_txn
(
self
,
txn
,
events
,
backfilled
):
"""
Store a room member in the database.
"""
def
str_or_none
(
val
:
Any
)
->
Optional
[
str
]:
return
val
if
isinstance
(
val
,
str
)
else
None
self
.
db_pool
.
simple_insert_many_txn
(
txn
,
table
=
"
room_memberships
"
,
...
...
@@ -1118,8 +1122,8 @@ class PersistEventsStore:
"
sender
"
:
event
.
user_id
,
"
room_id
"
:
event
.
room_id
,
"
membership
"
:
event
.
membership
,
"
display_name
"
:
event
.
content
.
get
(
"
displayname
"
,
None
),
"
avatar_url
"
:
event
.
content
.
get
(
"
avatar_url
"
,
None
),
"
display_name
"
:
str_or_none
(
event
.
content
.
get
(
"
displayname
"
)
),
"
avatar_url
"
:
str_or_none
(
event
.
content
.
get
(
"
avatar_url
"
)
),
}
for
event
in
events
],
...
...
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