From 6f8e15178fd31dce4e652891cb5e91841aa1ac4c Mon Sep 17 00:00:00 2001 From: Ske Date: Wed, 16 Sep 2020 22:47:40 +0200 Subject: [PATCH] Fix image proxy URL extensions Media proxy doesn't support format conversion by changing extension, needs a separate query parameter instead --- PluralKit.Bot/Commands/Avatars/ContextAvatarExt.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/PluralKit.Bot/Commands/Avatars/ContextAvatarExt.cs b/PluralKit.Bot/Commands/Avatars/ContextAvatarExt.cs index 0db82dd8..e4e06c40 100644 --- a/PluralKit.Bot/Commands/Avatars/ContextAvatarExt.cs +++ b/PluralKit.Bot/Commands/Avatars/ContextAvatarExt.cs @@ -15,7 +15,7 @@ namespace PluralKit.Bot // This lets us add resizing parameters to "borrow" their media proxy server to downsize the image // which in turn makes it more likely to be underneath the size limit! private static readonly Regex DiscordCdnUrl = new Regex(@"^https?://(?:cdn\.discordapp\.com|media\.discordapp\.net)/attachments/(\d{17,19})/(\d{17,19})/([^/\\&\?]+)\.(png|jpg|jpeg|webp)(\?.*)?$"); - private static readonly string DiscordMediaUrlReplacement = "https://media.discordapp.net/attachments/$1/$2/$3.jpg?width=256&height=256"; + private static readonly string DiscordMediaUrlReplacement = "https://media.discordapp.net/attachments/$1/$2/$3.$4?width=256&height=256&format=jpeg"; public static async Task MatchImage(this Context ctx) {