SEBWIN-379: Fixed request filter expressions containing trailing slashes after host.
This commit is contained in:
parent
e5659632b9
commit
54b5be830e
2 changed files with 39 additions and 1 deletions
|
@ -265,6 +265,44 @@ namespace SafeExamBrowser.Browser.UnitTests.Filters.Rules
|
||||||
Test(expression, positive, negative);
|
Test(expression, positive, negative);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[TestMethod]
|
||||||
|
public void TestHostWithTrailingSlash()
|
||||||
|
{
|
||||||
|
var expression = "host.org/";
|
||||||
|
var positive = new[]
|
||||||
|
{
|
||||||
|
"scheme://host.org",
|
||||||
|
"scheme://host.org/",
|
||||||
|
"scheme://host.org/url",
|
||||||
|
"scheme://host.org/url/",
|
||||||
|
"scheme://host.org/url/path",
|
||||||
|
"scheme://host.org/url/path/",
|
||||||
|
"scheme://user:password@www.host.org/url/path?param=123#fragment",
|
||||||
|
"scheme://user:password@www.host.org/url/path/?param=123#fragment"
|
||||||
|
};
|
||||||
|
|
||||||
|
Test(expression, positive, Array.Empty<string>());
|
||||||
|
}
|
||||||
|
|
||||||
|
[TestMethod]
|
||||||
|
public void TestHostWithoutTrailingSlash()
|
||||||
|
{
|
||||||
|
var expression = "host.org";
|
||||||
|
var positive = new[]
|
||||||
|
{
|
||||||
|
"scheme://host.org",
|
||||||
|
"scheme://host.org/",
|
||||||
|
"scheme://host.org/url",
|
||||||
|
"scheme://host.org/url/",
|
||||||
|
"scheme://host.org/url/path",
|
||||||
|
"scheme://host.org/url/path/",
|
||||||
|
"scheme://user:password@www.host.org/url/path?param=123#fragment",
|
||||||
|
"scheme://user:password@www.host.org/url/path/?param=123#fragment"
|
||||||
|
};
|
||||||
|
|
||||||
|
Test(expression, positive, Array.Empty<string>());
|
||||||
|
}
|
||||||
|
|
||||||
[TestMethod]
|
[TestMethod]
|
||||||
public void TestPortNumber()
|
public void TestPortNumber()
|
||||||
{
|
{
|
||||||
|
|
|
@ -118,7 +118,7 @@ namespace SafeExamBrowser.Browser.Filters.Rules
|
||||||
|
|
||||||
private void ParsePath(string expression)
|
private void ParsePath(string expression)
|
||||||
{
|
{
|
||||||
if (!string.IsNullOrWhiteSpace(expression))
|
if (!string.IsNullOrWhiteSpace(expression) && !expression.Equals("/"))
|
||||||
{
|
{
|
||||||
expression = Regex.Escape(expression);
|
expression = Regex.Escape(expression);
|
||||||
expression = ReplaceWildcard(expression);
|
expression = ReplaceWildcard(expression);
|
||||||
|
|
Loading…
Reference in a new issue