From 897fad12e6c613a09b5cf2b2afac07b7ba90a071 Mon Sep 17 00:00:00 2001 From: spiral Date: Thu, 22 Sep 2022 18:11:27 +0000 Subject: [PATCH] fix(bot): apply display name length checks when setting --- PluralKit.Bot/Commands/MemberEdit.cs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/PluralKit.Bot/Commands/MemberEdit.cs b/PluralKit.Bot/Commands/MemberEdit.cs index 180ab31a..74157419 100644 --- a/PluralKit.Bot/Commands/MemberEdit.cs +++ b/PluralKit.Bot/Commands/MemberEdit.cs @@ -423,6 +423,9 @@ public class MemberEdit { var newDisplayName = ctx.RemainderOrNull(false).NormalizeLineEndSpacing(); + if (newDisplayName.Length > Limits.MaxMemberNameLength) + throw Errors.StringTooLongError("Member display name", newDisplayName.Length, Limits.MaxMemberNameLength); + var patch = new MemberPatch { DisplayName = Partial.Present(newDisplayName) }; await ctx.Repository.UpdateMember(target.Id, patch);