-
-
Notifications
You must be signed in to change notification settings - Fork 80
Closed
Labels
enhancementNew feature or requestNew feature or requestgood first issueGood for newcomersGood for newcomers
Description
It can happen, thanks to copy&paste, that the preview image URL and the fallback image URL are literally the same.
That doesn't make much sense and should either pop up a warning message or even a validation error.
## Possible Solution
We can create our own attribute to do that:
[AttributeUsage(AttributeTargets.Property, AllowMultiple = false, Inherited = true)]
public sealed class FallbackUrlValidation : ValidationAttribute
{
protected override ValidationResult IsValid(object value, ValidationContext validationContext)
{
var model = validationContext.ObjectInstance as CreateNewModel;
if (model.PreviewImageUrl == model.PreviewImageUrlFallback)
{
return new ValidationResult("PreviewImageUrl and PreviewImageUrlFallback should not be the same");
}
return ValidationResult.Success;
}
}
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or requestgood first issueGood for newcomersGood for newcomers