mirror of
https://github.com/PluralKit/PluralKit.git
synced 2026-02-04 04:56:49 +00:00
Add a character limit to avatar URLs (256 for now)
This commit is contained in:
parent
2579683da9
commit
f803b9a392
5 changed files with 6 additions and 2 deletions
|
|
@ -72,6 +72,7 @@ namespace PluralKit.Bot
|
|||
}
|
||||
else if (ctx.RemainderOrNull() is string url)
|
||||
{
|
||||
if (url.Length > Limits.MaxUriLength) throw Errors.InvalidUrl(url);
|
||||
await AvatarUtils.VerifyAvatarOrThrow(url);
|
||||
target.AvatarUrl = url;
|
||||
await _data.SaveMember(target);
|
||||
|
|
@ -141,6 +142,7 @@ namespace PluralKit.Bot
|
|||
}
|
||||
else if (ctx.RemainderOrNull() is string url)
|
||||
{
|
||||
if (url.Length > Limits.MaxUriLength) throw Errors.InvalidUrl(url);
|
||||
await AvatarUtils.VerifyAvatarOrThrow(url);
|
||||
guildData.AvatarUrl = url;
|
||||
await _data.SetMemberGuildSettings(target, ctx.Guild.Id, guildData);
|
||||
|
|
|
|||
|
|
@ -156,6 +156,7 @@ namespace PluralKit.Bot
|
|||
{
|
||||
// They can't both be null - otherwise we would've hit the conditional at the very top
|
||||
string url = ctx.RemainderOrNull() ?? ctx.Message.Attachments.FirstOrDefault()?.ProxyUrl;
|
||||
if (url?.Length > Limits.MaxUriLength) throw Errors.InvalidUrl(url);
|
||||
await ctx.BusyIndicator(() => AvatarUtils.VerifyAvatarOrThrow(url));
|
||||
|
||||
ctx.System.AvatarUrl = url;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue