diff --git a/PluralKit.API/Controllers/MemberController.cs b/PluralKit.API/Controllers/MemberController.cs index 71247404..73f44c78 100644 --- a/PluralKit.API/Controllers/MemberController.cs +++ b/PluralKit.API/Controllers/MemberController.cs @@ -101,12 +101,12 @@ namespace PluralKit.API.Controllers return BadRequest(); member.Name = newMember.Name; - member.DisplayName = newMember.DisplayName; - member.Color = newMember.Color; - member.AvatarUrl = newMember.AvatarUrl; + member.DisplayName = newMember.DisplayName.NullIfEmpty(); + member.Color = newMember.Color.NullIfEmpty(); + member.AvatarUrl = newMember.AvatarUrl.NullIfEmpty(); member.Birthday = newMember.Birthday; - member.Pronouns = newMember.Pronouns; - member.Description = newMember.Description; + member.Pronouns = newMember.Pronouns.NullIfEmpty(); + member.Description = newMember.Description.NullIfEmpty(); member.ProxyTags = newMember.ProxyTags; member.KeepProxy = newMember.KeepProxy; await _data.SaveMember(member); diff --git a/PluralKit.API/Controllers/SystemController.cs b/PluralKit.API/Controllers/SystemController.cs index 1503c3fa..ce43700a 100644 --- a/PluralKit.API/Controllers/SystemController.cs +++ b/PluralKit.API/Controllers/SystemController.cs @@ -113,17 +113,17 @@ namespace PluralKit.API.Controllers var system = _auth.CurrentSystem; // Bounds checks - if (newSystem.Name.Length > Limits.MaxSystemNameLength) + if (newSystem.Name != null && newSystem.Name.Length > Limits.MaxSystemNameLength) return BadRequest($"System name too long ({newSystem.Name.Length} > {Limits.MaxSystemNameLength}."); - if (newSystem.Tag.Length > Limits.MaxSystemTagLength) + if (newSystem.Tag != null && newSystem.Tag.Length > Limits.MaxSystemTagLength) return BadRequest($"System tag too long ({newSystem.Tag.Length} > {Limits.MaxSystemTagLength}."); - if (newSystem.Description.Length > Limits.MaxDescriptionLength) + if (newSystem.Description != null && newSystem.Description.Length > Limits.MaxDescriptionLength) return BadRequest($"System description too long ({newSystem.Description.Length} > {Limits.MaxDescriptionLength}."); - system.Name = newSystem.Name; - system.Description = newSystem.Description; - system.Tag = newSystem.Tag; - system.AvatarUrl = newSystem.AvatarUrl; + system.Name = newSystem.Name.NullIfEmpty(); + system.Description = newSystem.Description.NullIfEmpty(); + system.Tag = newSystem.Tag.NullIfEmpty(); + system.AvatarUrl = newSystem.AvatarUrl.NullIfEmpty(); system.UiTz = newSystem.UiTz ?? "UTC"; await _data.SaveSystem(system);