diff options
author | Richard van der Hoff <richard@matrix.org> | 2018-10-24 10:41:45 +0100 |
---|---|---|
committer | Richard van der Hoff <richard@matrix.org> | 2018-10-24 11:11:24 +0100 |
commit | 7e07d25ed64e6af403dd508a2b5226e8d18fc1ac (patch) | |
tree | 0d62393e2f7ede6ea79fcedf793fbc20de39e3d8 /tests/api | |
parent | Merge pull request #4075 from matrix-org/rav/fix_pusher_logcontexts (diff) | |
download | synapse-7e07d25ed64e6af403dd508a2b5226e8d18fc1ac.tar.xz |
Allow backslashes in event field filters
Fixes a bug introduced in https://github.com/matrix-org/synapse/pull/1783 which meant that single backslashes were not allowed in event field filters. The intention here is to allow single-backslashes, but disallow double-backslashes.
Diffstat (limited to 'tests/api')
-rw-r--r-- | tests/api/test_filtering.py | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/tests/api/test_filtering.py b/tests/api/test_filtering.py index 48b2d3d663..2a7044801a 100644 --- a/tests/api/test_filtering.py +++ b/tests/api/test_filtering.py @@ -60,7 +60,7 @@ class FilteringTestCase(unittest.TestCase): invalid_filters = [ {"boom": {}}, {"account_data": "Hello World"}, - {"event_fields": ["\\foo"]}, + {"event_fields": [r"\\foo"]}, {"room": {"timeline": {"limit": 0}, "state": {"not_bars": ["*"]}}}, {"event_format": "other"}, {"room": {"not_rooms": ["#foo:pik-test"]}}, @@ -109,6 +109,16 @@ class FilteringTestCase(unittest.TestCase): "event_format": "client", "event_fields": ["type", "content", "sender"], }, + + # a single backslash should be permitted (though it is debatable whether + # it should be permitted before anything other than `.`, and what that + # actually means) + # + # (note that event_fields is implemented in + # synapse.events.utils.serialize_event, and so whether this actually works + # is tested elsewhere. We just want to check that it is allowed through the + # filter validation) + {"event_fields": [r"foo\.bar"]}, ] for filter in valid_filters: try: |