From eadbad7563dfa571127e962d343726d6eec469ae Mon Sep 17 00:00:00 2001 From: tdro Date: Tue, 9 May 2023 19:42:00 -0400 Subject: themes/default/layouts/partials/author-picture: Guard against empty metadata Can be empty under some conditions --- themes/default/layouts/partials/author-picture.html | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'themes') diff --git a/themes/default/layouts/partials/author-picture.html b/themes/default/layouts/partials/author-picture.html index 9153e08..01786e7 100644 --- a/themes/default/layouts/partials/author-picture.html +++ b/themes/default/layouts/partials/author-picture.html @@ -20,9 +20,11 @@ {{- $source = print "/" (partial "function-paths.html").media "/" $author.user "/" $author.user "-profile" (path.Ext $author.picture.profile) -}} {{- $sourceset = print "/" (partial "function-paths.html").media "/" $author.user "/" $author.user "-profile.webp" -}} {{- with $metadata := resources.Get $metadata -}} - {{- $metadata = $metadata.Content | transform.Unmarshal -}} - {{- $width = $metadata.picture.profileWidth -}} - {{- $height = $metadata.picture.profileHeight -}} + {{- with $content := $metadata.Content -}} + {{- $metadata = $content | transform.Unmarshal -}} + {{- $width = $metadata.picture.profileWidth -}} + {{- $height = $metadata.picture.profileHeight -}} + {{- end -}} {{- else -}} {{- $source = "/data/media/404.png" -}} {{- $sourceset = "" -}} -- cgit v1.2.3