From f6bfd18816de45c6fd9a903b7595cb19d59266c4 Mon Sep 17 00:00:00 2001 From: Vendicated Date: Thu, 19 Jun 2025 23:03:15 +0200 Subject: [PATCH] ViewIcons: fix viewing animated icons/banners --- src/plugins/viewIcons/index.tsx | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/plugins/viewIcons/index.tsx b/src/plugins/viewIcons/index.tsx index 07630a00..2afdb2d5 100644 --- a/src/plugins/viewIcons/index.tsx +++ b/src/plugins/viewIcons/index.tsx @@ -71,9 +71,14 @@ const openAvatar = (url: string) => openImage(url, 512, 512); const openBanner = (url: string) => openImage(url, 1024); function openImage(url: string, width: number, height?: number) { - const format = url.startsWith("/") ? "png" : settings.store.format; - const u = new URL(url, window.location.href); + + const format = url.startsWith("/") + ? "png" + : u.searchParams.get("animated") === "true" + ? "gif" + : settings.store.format; + u.searchParams.set("size", settings.store.imgSize); u.pathname = u.pathname.replace(/\.(png|jpe?g|webp)$/, `.${format}`); url = u.toString();