From 012b85283ebe268204d0b6ae276226d4409604a8 Mon Sep 17 00:00:00 2001 From: Thomas Sileo Date: Mon, 23 Jul 2018 22:34:12 +0200 Subject: [PATCH] Fix the image caching --- tasks.py | 3 ++- templates/utils.html | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/tasks.py b/tasks.py index d7f5f05..1670fcf 100644 --- a/tasks.py +++ b/tasks.py @@ -234,7 +234,8 @@ def cache_attachments(self, iri: str) -> None: if activity.has_type(ap.ActivityType.CREATE): for attachment in activity.get_object()._data.get("attachment", []): - MEDIA_CACHE.cache(attachment["url"], Kind.ATTACHMENT) + if attachment.get("mediaType", "").startswith("image/"): + MEDIA_CACHE.cache(attachment["url"], Kind.ATTACHMENT) log.info(f"attachments cached for {iri}") diff --git a/templates/utils.html b/templates/utils.html index ebf5f23..88720f2 100644 --- a/templates/utils.html +++ b/templates/utils.html @@ -54,7 +54,7 @@