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

namespace I2R.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);
}