summary refs log tree commit diff
diff options
context:
space:
mode:
authorErik Johnston <erik@matrix.org>2017-06-19 17:47:55 +0100
committerErik Johnston <erik@matrix.org>2017-06-19 17:48:28 +0100
commit385dcb7c60a0762f29779e9c2ab6a984636092df (patch)
tree33ca83069a1a50b22815f3d67f551df79fca0c63
parentAdd API to quarantine media (diff)
downloadsynapse-385dcb7c60a0762f29779e9c2ab6a984636092df.tar.xz
Handle thumbnail urls
-rw-r--r--synapse/storage/room.py26
1 files changed, 14 insertions, 12 deletions
diff --git a/synapse/storage/room.py b/synapse/storage/room.py
index e9c1549c00..23688430b7 100644
--- a/synapse/storage/room.py
+++ b/synapse/storage/room.py
@@ -562,18 +562,20 @@ class RoomStore(SQLBaseStore):
                     next_token = stream_ordering
                     content = json.loads(content_json)
 
-                    url = content.get("url")
-                    if not url:
-                        continue
-
-                    matches = mxc_re.match(url)
-                    if matches:
-                        hostname = matches.group(1)
-                        media_id = matches.group(2)
-                        if hostname == self.hostname:
-                            local_media_mxcs.append(media_id)
-                        else:
-                            remote_media_mxcs.append((hostname, media_id))
+                    content_url = content.get("url")
+                    thumbnail_url = content.get("info", {}).get("thumbnail_url")
+
+                    for url in (content_url, thumbnail_url):
+                        if not url:
+                            continue
+                        matches = mxc_re.match(url)
+                        if matches:
+                            hostname = matches.group(1)
+                            media_id = matches.group(2)
+                            if hostname == self.hostname:
+                                local_media_mxcs.append(media_id)
+                            else:
+                                remote_media_mxcs.append((hostname, media_id))
 
                 # Now update all the tables to set the quarantined_by flag