From 7059d5849bf2fd4cc4bd229595fed0cfa987d1c2 Mon Sep 17 00:00:00 2001 From: John Coffey Date: Mon, 16 Nov 2026 15:01:48 -0700 Subject: [PATCH] Show a logo set as an https URL in the console The console fetched /logo and showed the response as a blob. For a logo set as an https URL the server answers /logo with a redirect to that URL, and a fetch only follows a redirect to another site when the site sends CORS headers, which most image hosts don't. The fetch failed and the console fell back to the inbuxa logo, while the server's sign-in page, which uses a plain image, showed the custom one. Load /logo as an image instead: an image follows the redirect without CORS. The also falls back to the inbuxa logo if the custom one stops loading later. Fixes #225 --- src/components/common/Logo.tsx | 16 ++++++++-- src/lib/logoCache.test.ts | 55 ++++++++++++++++++++++------------ src/lib/logoCache.ts | 32 ++++++++++++-------- 3 files changed, 69 insertions(+), 34 deletions(-) diff --git a/src/components/common/Logo.tsx b/src/components/common/Logo.tsx index 54ad0d9..a862b46 100644 --- a/src/components/common/Logo.tsx +++ b/src/components/common/Logo.tsx @@ -4,7 +4,7 @@ * SPDX-License-Identifier: AGPL-3.0-only */ -import { useEffect, useSyncExternalStore } from 'react'; +import { useEffect, useState, useSyncExternalStore } from 'react'; import { useTranslation } from 'react-i18next'; import inbuxaMark from '@/assets/inbuxa-mark.png'; @@ -63,10 +63,22 @@ export function DefaultLogo() { export default function Logo() { const { t } = useTranslation(); const logo = useSyncExternalStore(subscribeToLogo, getLogoState, getLogoState); + const [broken, setBroken] = useState(false); useEffect(loadLogoOnce, []); switch (logo.status) { case 'custom': - return {t('logo.alt',; + // A logo that loaded once can still fail later (its host goes away + // after the cache runs out); the inbuxa logo beats a broken image. + return broken ? ( + + ) : ( + {t('logo.alt', setBroken(true)} + /> + ); case 'loading': return