This commit is contained in:
Paul Schneider 2021-09-05 19:33:39 +01:00
commit e6f4349621
3 changed files with 3 additions and 23 deletions

View file

@ -1,20 +0,0 @@
using System;
using System.ComponentModel.DataAnnotations;
using System.Linq;
namespace isnd.Controllers
{
internal class SafeNameAttribute : ValidationAttribute
{
public override bool IsValid(object value)
{
if (!(value is string))
return false;
string str = value as string;
if (str.Length>126) return false;
if (str.Any(c => !char.IsLetterOrDigit(c)
&& !"-_.".Contains(c))) return false;
return true;
}
}
}