From a0a4848ecb325c5c00c12dc05806367429c4fc97 Mon Sep 17 00:00:00 2001 From: duckietm Date: Fri, 1 May 2026 08:24:16 +0200 Subject: [PATCH] =?UTF-8?q?=F0=9F=86=99=20Small=20update=20news=20images?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/login/utils/news.ts | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/components/login/utils/news.ts b/src/components/login/utils/news.ts index 510655c..0fa0c82 100644 --- a/src/components/login/utils/news.ts +++ b/src/components/login/utils/news.ts @@ -9,8 +9,12 @@ export const resolveNewsImage = (raw: string | null | undefined): string => const value = (raw ?? '').trim(); if(!value) return ''; if(/^https?:\/\//i.test(value)) return value; - if(value.startsWith('//')) return value; - if(value.startsWith('/') && !value.startsWith('//')) return value; + if(value.startsWith('//')) return window.location.protocol + value; + if(value.startsWith('/')) + { + try { return new URL(value, window.location.origin).href; } + catch { return window.location.origin + value; } + } if(value.startsWith('data:')) { return /^data:image\/[a-z0-9.+-]+[,;]/i.test(value) ? value : '';