mirror of
https://github.com/PluralKit/PluralKit.git
synced 2026-02-14 09:40:10 +00:00
Handle null avatar URLs (the other place too)
This commit is contained in:
parent
eb142a81fa
commit
7681978435
1 changed files with 4 additions and 3 deletions
|
|
@ -25,8 +25,9 @@ namespace PluralKit.Core
|
||||||
// discord mediaproxy URLs used to be stored directly in the database, so now we cleanup image urls before using them outside of proxying
|
// discord mediaproxy URLs used to be stored directly in the database, so now we cleanup image urls before using them outside of proxying
|
||||||
private static readonly Regex MediaProxyUrl = new Regex(@"^https?://media.discordapp.net/attachments/(\d{17,19})/(\d{17,19})/([^/\\&\?]+)\.(png|jpg|jpeg|webp)(\?.*)?$");
|
private static readonly Regex MediaProxyUrl = new Regex(@"^https?://media.discordapp.net/attachments/(\d{17,19})/(\d{17,19})/([^/\\&\?]+)\.(png|jpg|jpeg|webp)(\?.*)?$");
|
||||||
private static readonly string DiscordCdnReplacement = "https://cdn.discordapp.com/attachments/$1/$2/$3.$4";
|
private static readonly string DiscordCdnReplacement = "https://cdn.discordapp.com/attachments/$1/$2/$3.$4";
|
||||||
public static string TryGetCleanCdnUrl(this string url) =>
|
public static string? TryGetCleanCdnUrl(this string? url)
|
||||||
MediaProxyUrl.Replace(url, DiscordCdnReplacement);
|
{
|
||||||
|
return url == null ? null : MediaProxyUrl.Replace(url, DiscordCdnReplacement);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue