0
0
Fork 1
mirror of https://mau.dev/maunium/synapse.git synced 2024-12-14 15:53:51 +01:00

make meta comparisons case insensitive

This commit is contained in:
Matthew Hodgson 2016-04-02 01:35:44 +01:00
parent 5fd07da764
commit b26e8604f1

View file

@ -170,7 +170,7 @@ class PreviewUrlResource(BaseMediaResource):
if 'og:image' not in og: if 'og:image' not in og:
# TODO: extract a favicon failing all else # 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: if meta_image:
og['og:image'] = self._rebase_url(meta_image[0], media_info['uri']) og['og:image'] = self._rebase_url(meta_image[0], media_info['uri'])
else: else:
@ -198,7 +198,7 @@ class PreviewUrlResource(BaseMediaResource):
del og["og:image"] del og["og:image"]
if 'og:description' not in og: 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: if meta_description:
og['og:description'] = meta_description[0] og['og:description'] = meta_description[0]
else: else: