Protect call to ParseBase64Image

This commit is contained in:
sudokoko 2024-03-27 23:50:23 -04:00
commit aafdaf19fd
No known key found for this signature in database
GPG key ID: 248D68C664937395

View file

@ -39,15 +39,13 @@ public class UserSettingsPage : BaseLayout
if (!this.User.IsModerator && this.User != this.ProfileUser) return this.Redirect("~/user/" + userId);
// Deny request if in read-only mode
if (avatar != null && ServerConfiguration.Instance.UserGeneratedContentLimits.ReadOnlyMode)
return this.Redirect($"~/user/{userId}");
string? avatarHash = await FileHelper.ParseBase64Image(avatar);
if (avatarHash != null)
{
// Deny request if in read-only mode
if (ServerConfiguration.Instance.UserGeneratedContentLimits.ReadOnlyMode) return this.Redirect($"~/user/{userId}");
this.ProfileUser.IconHash = avatarHash;
}
if (avatarHash != null) this.ProfileUser.IconHash = avatarHash;
if (this.User.IsAdmin) this.ProfileUser.ProfileTag = profileTag;