summary refs log tree commit diff
path: root/synapse/api
diff options
context:
space:
mode:
authorMichael Telatynski <7t3chguy@googlemail.com>2019-01-06 21:43:26 +0000
committerRichard van der Hoff <1389908+richvdh@users.noreply.github.com>2019-01-06 21:43:25 +0000
commita27e501b0920648458dd1a9a5516af6e52e060cf (patch)
tree25d51e3c22fde590bf49468fbf5fd23c63b75a5f /synapse/api
parentUpdate debian Conflicts specifications (#4349) (diff)
downloadsynapse-a27e501b0920648458dd1a9a5516af6e52e060cf.tar.xz
fix the check for whether `is_url` to match all the other ones in codebase (#3405)
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
Diffstat (limited to 'synapse/api')
-rw-r--r--synapse/api/filtering.py11
1 files changed, 8 insertions, 3 deletions
diff --git a/synapse/api/filtering.py b/synapse/api/filtering.py
index 677c0bdd4c..16ad654864 100644
--- a/synapse/api/filtering.py
+++ b/synapse/api/filtering.py
@@ -12,6 +12,8 @@
 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 # See the License for the specific language governing permissions and
 # limitations under the License.
+from six import text_type
+
 import jsonschema
 from canonicaljson import json
 from jsonschema import FormatChecker
@@ -353,7 +355,7 @@ class Filter(object):
             sender = event.user_id
             room_id = None
             ev_type = "m.presence"
-            is_url = False
+            contains_url = False
         else:
             sender = event.get("sender", None)
             if not sender:
@@ -368,13 +370,16 @@ class Filter(object):
 
             room_id = event.get("room_id", None)
             ev_type = event.get("type", None)
-            is_url = "url" in event.get("content", {})
+
+            content = event.get("content", {})
+            # check if there is a string url field in the content for filtering purposes
+            contains_url = isinstance(content.get("url"), text_type)
 
         return self.check_fields(
             room_id,
             sender,
             ev_type,
-            is_url,
+            contains_url,
         )
 
     def check_fields(self, room_id, sender, event_type, contains_url):