version 1.1L

* UI responsive table fix
* Background scanning for backends
* Callback URL parameter to notify on scan results
This commit is contained in:
Volodymyr Smirnov
2020-10-30 11:20:08 +02:00
parent 3ff8d1d05f
commit ee071811e8
30 changed files with 345 additions and 148 deletions

View File

@@ -8,9 +8,23 @@ namespace MalwareMultiScan.Api.Attributes
/// </summary>
public class IsHttpUrlAttribute : ValidationAttribute
{
private readonly bool _failOnNull;
/// <summary>
/// Initialize http URL validation attribute.
/// </summary>
/// <param name="failOnNull">True if URL is mandatory, false otherwise.</param>
public IsHttpUrlAttribute(bool failOnNull = true)
{
_failOnNull = failOnNull;
}
/// <inheritdoc />
protected override ValidationResult IsValid(object value, ValidationContext validationContext)
{
if (!_failOnNull && string.IsNullOrEmpty(value.ToString()))
return ValidationResult.Success;
if (!Uri.TryCreate((string) value, UriKind.Absolute, out var uri)
|| !uri.IsAbsoluteUri
|| uri.Scheme.ToLowerInvariant() != "http"