mirror of
https://github.com/superseriousbusiness/gotosocial
synced 2025-06-05 21:59:39 +02:00
[bugfix] Extract description as summary
first, fall back to name
(#2303)
This commit is contained in:
@@ -600,12 +600,23 @@ func ExtractAttachment(i Attachmentable) (*gtsmodel.MediaAttachment, error) {
|
||||
|
||||
return >smodel.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.
|
||||
|
Reference in New Issue
Block a user