summary refs log tree commit diff
path: root/synapse
diff options
context:
space:
mode:
authorMatthew Hodgson <matthew@matrix.org>2016-04-02 01:35:44 +0100
committerMatthew Hodgson <matthew@matrix.org>2016-04-02 01:35:44 +0100
commitb26e8604f168b0f1ecc095bd0d6a717128361a41 (patch)
tree47d6af41adfca1f0509c9d7bcbe6c5ec0d115abf /synapse
parentrefactor calc_og; spider image URLs; fix xpath; add a (broken) expiringcache;... (diff)
downloadsynapse-b26e8604f168b0f1ecc095bd0d6a717128361a41.tar.xz
make meta comparisons case insensitive
Diffstat (limited to 'synapse')
-rw-r--r--synapse/rest/media/v1/preview_url_resource.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/synapse/rest/media/v1/preview_url_resource.py b/synapse/rest/media/v1/preview_url_resource.py
index 1273472dab..77757548bd 100644
--- a/synapse/rest/media/v1/preview_url_resource.py
+++ b/synapse/rest/media/v1/preview_url_resource.py
@@ -170,7 +170,7 @@ class PreviewUrlResource(BaseMediaResource):
 
         if 'og:image' not in og:
             # TODO: extract a favicon failing all else
-            meta_image = tree.xpath("//*/meta[@itemprop='image']/@content");
+            meta_image = tree.xpath("//*/meta[translate(@itemprop, 'IMAGE', 'image')='image']/@content");
             if meta_image:
                 og['og:image'] = self._rebase_url(meta_image[0], media_info['uri'])
             else:
@@ -198,7 +198,7 @@ class PreviewUrlResource(BaseMediaResource):
                 del og["og:image"]
 
         if 'og:description' not in og:
-            meta_description = tree.xpath("//*/meta[@name='description']/@content");
+            meta_description = tree.xpath("//*/meta[translate(@name, 'DESCRIPTION', 'description')='description']/@content");
             if meta_description:
                 og['og:description'] = meta_description[0]
             else: