From c8d467dff35a000c32509ba1673613a90ed4e7c7 Mon Sep 17 00:00:00 2001 From: prql-bot <107324867+prql-bot@users.noreply.github.com> Date: Wed, 10 Jun 2026 05:49:41 +0000 Subject: [PATCH] fix: tolerate Twitter CDN failures in web testimonials build resources.GetRemote fails the Hugo build on any HTTP request error (e.g. a timeout), so a single slow or unreachable Twitter avatar fetch aborted the entire build-web job. The previous `with`/`else` only caught a 404 (which returns nil), not request errors. Wrap both the default-image and per-author avatar fetches in `try` so a failed fetch degrades to a fallback image with a warning instead of failing the build. A transparent 1x1 data-URI is the ultimate fallback, so the build no longer hard-depends on Twitter's CDN being reachable. Co-Authored-By: Claude --- .../partials/section-testimonials.html | 29 +++++++++++++++---- 1 file changed, 23 insertions(+), 6 deletions(-) diff --git a/web/website/themes/prql-theme/layouts/partials/section-testimonials.html b/web/website/themes/prql-theme/layouts/partials/section-testimonials.html index cb90e57c32ce..e2277f7a0041 100644 --- a/web/website/themes/prql-theme/layouts/partials/section-testimonials.html +++ b/web/website/themes/prql-theme/layouts/partials/section-testimonials.html @@ -54,14 +54,31 @@

{{ .title | markdownify }}

> {{/* The Firefox tracking protection blocks images hosted on pbs.twitter.com, see https://bugzilla.mozilla.org/show_bug.cgi?id=1458915 - So we just download the images when building the website. + So we download the images when building the website. The + fetches are wrapped in `try` so a slow or unreachable + Twitter CDN degrades to a fallback image rather than + failing the whole build — resources.GetRemote otherwise + fails the build on a request error such as a timeout, see + https://gohugo.io/functions/resources/getremote/#error-handling */}} - {{ $imageSrc := (resources.GetRemote "https://abs.twimg.com/sticky/default_profile_images/default_profile_normal.png" | resources.Copy "default.png").RelPermalink }} + {{ $profileImg := .profile_image_url_https }} {{ $localImgPath := printf "cached-avatars/%s.png" .screen_name }} - {{ with resources.GetRemote .profile_image_url_https }} - {{ $imageSrc = (resources.Copy $localImgPath .).RelPermalink }} - {{ else }} - {{ warnf "[section-testimonials.html] couldn't fetch remote image %v" .profile_image_url_https }} + {{/* Transparent 1x1 GIF as the ultimate fallback, so the + build never hard-depends on the network being up. */}} + {{ $imageSrc := "data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==" }} + {{ with try (resources.GetRemote "https://abs.twimg.com/sticky/default_profile_images/default_profile_normal.png") }} + {{ with .Err }} + {{ warnf "[section-testimonials.html] couldn't fetch default image: %s" . }} + {{ else with .Value }} + {{ $imageSrc = (resources.Copy "default.png" .).RelPermalink }} + {{ end }} + {{ end }} + {{ with try (resources.GetRemote $profileImg) }} + {{ with .Err }} + {{ warnf "[section-testimonials.html] couldn't fetch remote image %v: %s" $profileImg . }} + {{ else with .Value }} + {{ $imageSrc = (resources.Copy $localImgPath .).RelPermalink }} + {{ end }} {{ end }}