summaryrefslogtreecommitdiff
path: root/internal/ap/extract.go
diff options
context:
space:
mode:
Diffstat (limited to 'internal/ap/extract.go')
-rw-r--r--internal/ap/extract.go13
1 files changed, 12 insertions, 1 deletions
diff --git a/internal/ap/extract.go b/internal/ap/extract.go
index 41cc5dcbc..6d224e9a8 100644
--- a/internal/ap/extract.go
+++ b/internal/ap/extract.go
@@ -600,12 +600,23 @@ func ExtractAttachment(i Attachmentable) (*gtsmodel.MediaAttachment, error) {
return &gtsmodel.MediaAttachment{
RemoteURL: remoteURL.String(),
- Description: ExtractName(i),
+ Description: ExtractDescription(i),
Blurhash: ExtractBlurhash(i),
Processing: gtsmodel.ProcessingStatusReceived,
}, nil
}
+// ExtractDescription extracts the image description
+// of an attachmentable, if present. Will try the
+// 'summary' prop first, then fall back to 'name'.
+func ExtractDescription(i Attachmentable) string {
+ if summary := ExtractSummary(i); summary != "" {
+ return summary
+ }
+
+ return ExtractName(i)
+}
+
// ExtractBlurhash extracts the blurhash string value
// from the given WithBlurhash interface, or returns
// an empty string if nothing is found.