DRY-ify checking URL length for avatars

This commit is contained in:
spiral
2020-11-22 15:43:38 -05:00
parent 7f82a3e63a
commit 05f1ee92ea
4 changed files with 4 additions and 12 deletions

View File

@@ -11,6 +11,9 @@ namespace PluralKit.Bot {
public static class AvatarUtils {
public static async Task VerifyAvatarOrThrow(string url)
{
if (url.Length > Limits.MaxUriLength)
throw Errors.UrlTooLong(url);
// List of MIME types we consider acceptable
var acceptableMimeTypes = new[]
{