summaryrefslogtreecommitdiff
path: root/internal/api/util/opengraph.go
diff options
context:
space:
mode:
authorLibravatar tobi <tobi.smethurst@protonmail.com>2025-06-02 12:52:51 +0200
committerLibravatar tobi <kipvandenbos@noreply.codeberg.org>2025-06-02 12:52:51 +0200
commit6d511d696b760b097b74daab8b48868ed849dc49 (patch)
treece4415187fd5c18a25b1e0d0eaa1226cb07fc6ad /internal/api/util/opengraph.go
parent[feature] /api/v1/follow_requests/outgoing (#4224) (diff)
downloadgotosocial-6d511d696b760b097b74daab8b48868ed849dc49.tar.xz
[bugfix] Fix nil ptr for audio attachments with no preview in web (#4227)
Fixes a cheeky little nil pointer bug that I wrote. Reviewed-on: https://codeberg.org/superseriousbusiness/gotosocial/pulls/4227 Co-authored-by: tobi <tobi.smethurst@protonmail.com> Co-committed-by: tobi <tobi.smethurst@protonmail.com>
Diffstat (limited to 'internal/api/util/opengraph.go')
-rw-r--r--internal/api/util/opengraph.go7
1 files changed, 4 insertions, 3 deletions
diff --git a/internal/api/util/opengraph.go b/internal/api/util/opengraph.go
index 5e1bdf3d2..47a576aac 100644
--- a/internal/api/util/opengraph.go
+++ b/internal/api/util/opengraph.go
@@ -235,9 +235,10 @@ func (o *OGMeta) WithStatus(status *apimodel.WebStatus) *OGMeta {
// Add this to our gathered entries.
ogMedias = append(ogMedias, ogMedia)
- if a.Type != "image" {
- // Add static/thumbnail
- // for non-images.
+ // Add static/thumb for non-images
+ // (eg., audio files) only if they
+ // have a preview url set.
+ if a.Type != "image" && a.PreviewURL != nil {
ogMedias = append(
ogMedias,
OGMedia{