mirror of
https://github.com/PluralKit/PluralKit.git
synced 2026-02-04 04:56:49 +00:00
fix(bot): remove query params from image attachment URLs for now
Discord is adding authentication parameters to CDN URLs - these being present in stored URLs breaks when they expire, but CDN URLs still work without those parameters until November/December 2023
This commit is contained in:
parent
1777070694
commit
8cf50a7d97
1 changed files with 5 additions and 2 deletions
|
|
@ -33,8 +33,11 @@ public static class ContextAvatarExt
|
|||
// If we have an attachment, use that
|
||||
if (ctx.Message.Attachments.FirstOrDefault() is { } attachment)
|
||||
{
|
||||
var url = attachment.ProxyUrl;
|
||||
return new ParsedImage { Url = url, Source = AvatarSource.Attachment };
|
||||
// XXX: strip query params from attachment URLs because of new Discord CDN shenanigans
|
||||
var uriBuilder = new UriBuilder(attachment.ProxyUrl);
|
||||
uriBuilder.Query = "";
|
||||
|
||||
return new ParsedImage { Url = uriBuilder.Uri.AbsoluteUri, Source = AvatarSource.Attachment };
|
||||
}
|
||||
|
||||
// We should only get here if there are no arguments (which would get parsed as URL + throw if error)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue