summaryrefslogtreecommitdiff
path: root/internal/web/opengraph.go
diff options
context:
space:
mode:
authorLibravatar tobi <31960611+tsmethurst@users.noreply.github.com>2023-11-10 19:29:26 +0100
committerLibravatar GitHub <noreply@github.com>2023-11-10 19:29:26 +0100
commitba9d6b467a1f03447789844048d913738c843569 (patch)
tree5a464ee4a33f26e3284179582ab6d3332d9d5388 /internal/web/opengraph.go
parent[chore/bugfix/horror] Allow `expires_in` and poll choices to be parsed from s... (diff)
downloadgotosocial-ba9d6b467a1f03447789844048d913738c843569.tar.xz
[feature] Media attachment placeholders (#2331)
* [feature] Use placeholders for unknown media types * fix read of underreported small files * switch to reduce nesting * simplify cleanup
Diffstat (limited to 'internal/web/opengraph.go')
-rw-r--r--internal/web/opengraph.go7
1 files changed, 6 insertions, 1 deletions
diff --git a/internal/web/opengraph.go b/internal/web/opengraph.go
index 188e2b8a1..66b6c6eea 100644
--- a/internal/web/opengraph.go
+++ b/internal/web/opengraph.go
@@ -123,9 +123,14 @@ func (og *ogMeta) withStatus(status *apimodel.Status) *ogMeta {
if !status.Sensitive && len(status.MediaAttachments) > 0 {
a := status.MediaAttachments[0]
- og.Image = a.PreviewURL
+
og.ImageWidth = strconv.Itoa(a.Meta.Small.Width)
og.ImageHeight = strconv.Itoa(a.Meta.Small.Height)
+
+ if a.PreviewURL != nil {
+ og.Image = *a.PreviewURL
+ }
+
if a.Description != nil {
og.ImageAlt = *a.Description
}