From 538cc4ae4039f2fe2a8b2de0f514502fcf4df912 Mon Sep 17 00:00:00 2001 From: Dustin Rouillard Date: Fri, 20 Sep 2024 13:42:17 -0600 Subject: [PATCH] Default to jpg over gif on quicklinks when not animated --- lib/api/routes/quicklinks/discord_cdn.ex | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/lib/api/routes/quicklinks/discord_cdn.ex b/lib/api/routes/quicklinks/discord_cdn.ex index c5f98b4..e1b10cd 100644 --- a/lib/api/routes/quicklinks/discord_cdn.ex +++ b/lib/api/routes/quicklinks/discord_cdn.ex @@ -36,6 +36,13 @@ defmodule Lanyard.Api.Quicklinks.DiscordCdn do end defp get_proxied_avatar(id, avatar, _discriminator, file_type) when is_binary(avatar) do + file_type = + if !String.starts_with?(avatar, "a_") && file_type == "gif" do + "jpg" + else + file_type + end + constructed_cdn_url = "#{@discord_cdn}/avatars/#{id}/#{avatar}.#{file_type}?size=1024" :get