diff --git a/ProjectLighthouse.Servers.Website/Pages/SlotSettingsPage.cshtml.cs b/ProjectLighthouse.Servers.Website/Pages/SlotSettingsPage.cshtml.cs index 744d0389..a2ceedf4 100644 --- a/ProjectLighthouse.Servers.Website/Pages/SlotSettingsPage.cshtml.cs +++ b/ProjectLighthouse.Servers.Website/Pages/SlotSettingsPage.cshtml.cs @@ -29,10 +29,10 @@ public class SlotSettingsPage : BaseLayout if (avatarHash != null) this.Slot.IconHash = avatarHash; name = SanitizationHelper.SanitizeString(name); - if (this.Slot.Name != name) this.Slot.Name = name; + if (this.Slot.Name != name && name.Length <= 64) this.Slot.Name = name; description = SanitizationHelper.SanitizeString(description); - if (this.Slot.Description != description) this.Slot.Description = description; + if (this.Slot.Description != description && description.Length <= 512) this.Slot.Description = description; labels = LabelHelper.RemoveInvalidLabels(SanitizationHelper.SanitizeString(labels)); if (this.Slot.AuthorLabels != labels) this.Slot.AuthorLabels = labels; diff --git a/ProjectLighthouse.Servers.Website/Pages/UserSettingsPage.cshtml.cs b/ProjectLighthouse.Servers.Website/Pages/UserSettingsPage.cshtml.cs index 16ab05fe..78796aef 100644 --- a/ProjectLighthouse.Servers.Website/Pages/UserSettingsPage.cshtml.cs +++ b/ProjectLighthouse.Servers.Website/Pages/UserSettingsPage.cshtml.cs @@ -37,7 +37,7 @@ public class UserSettingsPage : BaseLayout biography = SanitizationHelper.SanitizeString(biography); - if (this.ProfileUser.Biography != biography) this.ProfileUser.Biography = biography; + if (this.ProfileUser.Biography != biography && biography.Length <= 512) this.ProfileUser.Biography = biography; if (ServerConfiguration.Instance.Mail.MailEnabled && IsValidEmail(email) && (this.User == this.ProfileUser || this.User.IsAdmin)) { diff --git a/ProjectLighthouse/Helpers/LabelHelper.cs b/ProjectLighthouse/Helpers/LabelHelper.cs index b88dddc9..7a9fddbd 100644 --- a/ProjectLighthouse/Helpers/LabelHelper.cs +++ b/ProjectLighthouse/Helpers/LabelHelper.cs @@ -110,6 +110,8 @@ public static class LabelHelper public static string RemoveInvalidLabels(string authorLabels) { List labels = new(authorLabels.Split(",")); + if (labels.Count > 5) labels = labels.GetRange(0, 5); + for (int i = labels.Count - 1; i >= 0; i--) { if (!IsValidLabel(labels[i])) labels.Remove(labels[i]);