diff --git a/app/ap_object.py b/app/ap_object.py
index 2889f0c..a4bbab1 100644
--- a/app/ap_object.py
+++ b/app/ap_object.py
@@ -1,4 +1,5 @@
import hashlib
+import mimetypes
from datetime import datetime
from functools import cached_property
from typing import Any
@@ -276,6 +277,17 @@ class Attachment(BaseModel):
proxied_url: str | None = None
resized_url: str | None = None
+ @property
+ def mimetype(self) -> str:
+ mimetype = self.media_type
+ if not mimetype:
+ mimetype, _ = mimetypes.guess_type(self.url)
+
+ if not mimetype:
+ return "unknown"
+
+ return mimetype.split("/")[-1]
+
class RemoteObject(Object):
def __init__(self, raw_object: ap.RawObject, actor: Actor):
diff --git a/app/templates/utils.html b/app/templates/utils.html
index ef5ed3b..2760c48 100644
--- a/app/templates/utils.html
+++ b/app/templates/utils.html
@@ -343,11 +343,13 @@
{% elif attachment.type == "Audio" or (attachment | has_media_type("audio")) %}
{% elif attachment.type == "Link" %}
- {{ attachment.url }}
+ {{ attachment.url | truncate(64, True) }} ({{ attachment.mimetype}})
{% else %}
- {{ attachment.url }}
+
+ {% if attachment.name %}{{ attachment.name }}{% else %}{{ attachment.url | truncate(64, True) }}{% endif %}
+ ({{ attachment.mimetype }})
{% endif %}
- {% if object.sensitive %}
+ {% if object.sensitive and (attachment.type == "Image" or (attachment | has_media_type("image")) or attachment.type == "Video" or (attachment | has_media_type("video"))) %}