fix: stop crash on start with empty sentry dsn, make max avatar length a constant

This commit is contained in:
sam 2024-11-23 20:43:43 +01:00
parent d87856bf2c
commit 142ff36d3a
Signed by: sam
GPG key ID: B4EF20DDE721CAA1
2 changed files with 6 additions and 2 deletions

View file

@ -162,6 +162,7 @@ public static partial class ValidationUtils
}
public const int MaxBioLength = 1024;
public const int MaxAvatarLength = 1_500_000;
public static ValidationError? ValidateBio(string? bio)
{
@ -183,7 +184,10 @@ public static partial class ValidationUtils
return avatar?.Length switch
{
0 => ValidationError.GenericValidationError("Avatar cannot be empty", null),
> 1_500_000 => ValidationError.GenericValidationError("Avatar is too large", null),
> MaxAvatarLength => ValidationError.GenericValidationError(
"Avatar is too large",
null
),
_ => null,
};
}