Fix the image caching
This commit is contained in:
parent
0c60612407
commit
012b85283e
2 changed files with 3 additions and 2 deletions
1
tasks.py
1
tasks.py
|
@ -234,6 +234,7 @@ def cache_attachments(self, iri: str) -> None:
|
||||||
|
|
||||||
if activity.has_type(ap.ActivityType.CREATE):
|
if activity.has_type(ap.ActivityType.CREATE):
|
||||||
for attachment in activity.get_object()._data.get("attachment", []):
|
for attachment in activity.get_object()._data.get("attachment", []):
|
||||||
|
if attachment.get("mediaType", "").startswith("image/"):
|
||||||
MEDIA_CACHE.cache(attachment["url"], Kind.ATTACHMENT)
|
MEDIA_CACHE.cache(attachment["url"], Kind.ATTACHMENT)
|
||||||
|
|
||||||
log.info(f"attachments cached for {iri}")
|
log.info(f"attachments cached for {iri}")
|
||||||
|
|
|
@ -54,7 +54,7 @@
|
||||||
<ul>
|
<ul>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% for a in obj.attachment %}
|
{% for a in obj.attachment %}
|
||||||
{% if a.url | get_url | is_img %}
|
{% if a.mediaType.startswith("image/") %}
|
||||||
<a href="{{ a.url | get_attachment_url(None) }}"><img src="{{a.url | get_attachment_url(720) }}" class="img-attachment"></a>
|
<a href="{{ a.url | get_attachment_url(None) }}"><img src="{{a.url | get_attachment_url(720) }}" class="img-attachment"></a>
|
||||||
{% else %}
|
{% else %}
|
||||||
<li><a href="{{a.url | get_attachment_url(None) }}" class="l">{% if a.filename %}{{ a.filename }}{% else %}{{ a.url }}{% endif %}</a></li>
|
<li><a href="{{a.url | get_attachment_url(None) }}" class="l">{% if a.filename %}{{ a.filename }}{% else %}{{ a.url }}{% endif %}</a></li>
|
||||||
|
|
Loading…
Reference in a new issue