ViewIcons: fix viewing animated icons/banners

This commit is contained in:
Vendicated 2025-06-19 23:03:15 +02:00
parent ba76c43a26
commit f6bfd18816
No known key found for this signature in database
GPG key ID: D66986BAF75ECF18

View file

@ -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();