diff --git a/src/assets/fallback.jpg b/src/assets/fallback.jpg new file mode 100644 index 000000000..07da5b6a7 Binary files /dev/null and b/src/assets/fallback.jpg differ diff --git a/src/components/sponsors/OpenCollective/OcAvatar.astro b/src/components/sponsors/OpenCollective/OcAvatar.astro index 1f3647ed6..7c7d5a0a0 100644 --- a/src/components/sponsors/OpenCollective/OcAvatar.astro +++ b/src/components/sponsors/OpenCollective/OcAvatar.astro @@ -2,6 +2,7 @@ import { Image } from 'astro:assets'; import { OC_IMAGE_DIMENSION } from 'packages/fetch-sponsors/config'; import { type OpenCollectiveSponsor as Sponsor } from 'packages/fetch-sponsors/types'; +import fallbackImage from 'src/assets/fallback.jpg'; interface Props { sponsor: Sponsor; @@ -18,6 +19,11 @@ const roundingStyle: Record = { function getUrl(sponsor: Sponsor): string { return `${sponsor.socialLinks?.website ?? sponsor.profileUrl}?ref=tauri.app&utm_source=tauri.app`; } + +const res = await fetch(sponsor.avatarUrl, { method: 'HEAD' }); +if (res && !res.ok) { + sponsor.avatarUrl = fallbackImage.src; +} --- { diff --git a/src/content/docs/develop/Tests/WebDriver/Example/webdriverio.mdx b/src/content/docs/develop/Tests/WebDriver/Example/webdriverio.mdx index 34d99595b..ca14f6b09 100644 --- a/src/content/docs/develop/Tests/WebDriver/Example/webdriverio.mdx +++ b/src/content/docs/develop/Tests/WebDriver/Example/webdriverio.mdx @@ -113,11 +113,15 @@ export const config = { // ensure the rust project is built since we expect this binary to exist for the webdriver sessions onPrepare: () => { // Remove the extra `--` if you're not using npm! - spawnSync('npm', ['run', 'tauri', 'build', '--', '--debug', '--no-bundle'], { - cwd: path.resolve(__dirname, '..'), - stdio: 'inherit', - shell: true, - }); + spawnSync( + 'npm', + ['run', 'tauri', 'build', '--', '--debug', '--no-bundle'], + { + cwd: path.resolve(__dirname, '..'), + stdio: 'inherit', + shell: true, + } + ); }, // ensure we are running `tauri-driver` before the session starts so that we can proxy the webdriver requests