aboutsummaryrefslogtreecommitdiffstats
path: root/code/api/Utilities/FileValidators.cs
blob: 1fcaca14f8fbfc81259d141870ca14995d191d89 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
using System.Text.RegularExpressions;

namespace Quality.Storage.Api.Utilities;

public static class FileValidators
{
    private static Regex _fileNameRegex => new(@"([^\\/]+)$");
    private static Regex _folderNameRegex => new(@"^(\w+\.?)*\w+$");
    public static bool IsValidFileName(this string value) => _fileNameRegex.IsMatch(value);
    public static bool IsValidFolderName(this string value) => _folderNameRegex.IsMatch(value);
}