mirror of
https://github.com/BinaryAlley/Nemera.git
synced 2026-12-01 20:01:10 +00:00
Fixes paths regex checks not recognizing [ and ]
This commit is contained in:
1 parent
65ab0c99c3
commit
9e290d7f09
2 files changed
+4
-4
No files matched your search
+2
-2
@@ -50,8 +50,8 @@ public class UnixPathStrategy : IUnixPathStrategy
|
||||
// check for relative paths
|
||||
if (path.Path.StartsWith("./") || path.Path.StartsWith("../"))
|
||||
return false;
|
||||
string pathPattern = @"^\/([\w\-\.\~!$&'()*+,;=:@ ]+(\/[\w\-\.\~!$&'()*+,;=:@ ]+)*)?\/?$";
|
||||
return Regex.IsMatch(path.Path, pathPattern);
|
||||
const string PATH_PATTERN = @"^\/([\w\-\.\~!$&'()*+,;=:@\[\] ]+(\/[\w\-\.\~!$&'()*+,;=:@\[\] ]+)*)?\/?$";
|
||||
return Regex.IsMatch(path.Path, PATH_PATTERN);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
+2
-2
@@ -49,8 +49,8 @@ public class WindowsPathStrategy : IWindowsPathStrategy
|
||||
return false;
|
||||
// regular expression to match valid absolute paths
|
||||
// this allows drive letters (e.g., C:\) and UNC paths (e.g., \\server\share)
|
||||
string pathPattern = @"^(?:[a-zA-Z]:\\|\\\\[a-zA-Z0-9\s()._-]+\\[a-zA-Z0-9\s()._-]+)(?:[a-zA-Z0-9\s()._-]+\\)*[a-zA-Z0-9\s()._-]*\\?$";
|
||||
return Regex.IsMatch(path.Path, pathPattern);
|
||||
const string PATH_PATTERN = @"^(?:[a-zA-Z]:\\|\\\\[a-zA-Z0-9\s()._\[\]-]+\\[a-zA-Z0-9\s()._\[\]-]+)(?:[a-zA-Z0-9\s()._\[\]-]+\\)*[a-zA-Z0-9\s()._\[\]-]*\\?$";
|
||||
return Regex.IsMatch(path.Path, PATH_PATTERN);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
Reference in new issue
Block a user