diff --git a/synapse/storage/databases/main/filtering.py b/synapse/storage/databases/main/filtering.py index c334457af3..b3d785b38c 100644 --- a/synapse/storage/databases/main/filtering.py +++ b/synapse/storage/databases/main/filtering.py @@ -154,7 +154,9 @@ class FilteringWorkerStore(SQLBaseStore): self, user_id: UserID, filter_id: int | str ) -> JsonMapping: # filter_id is BIGINT UNSIGNED, so if it isn't a number, fail - # with a coherent error message rather than 500 M_UNKNOWN. + # with a coherent error message rather than 500 M_UNKNOWN. Bind the int + # (the value often arrives as a string from the request) so it matches + # the BIGINT column rather than relying on the driver to coerce it. try: filter_id = int(filter_id) except ValueError: