Fixes the issue with trailing slashes and the comparison in GlobalSettings and updated unit tests
to support the fix.
This commit is contained in:
@@ -834,12 +834,12 @@ namespace Umbraco.Core.Configuration
|
||||
public int Compare(string part, string whole)
|
||||
{
|
||||
// let the default string comparer deal with null or when part is not smaller then whole
|
||||
if (part == null || whole == null)
|
||||
if (part == null || whole == null || part.Length >= whole.Length)
|
||||
return _stringComparer.Compare(part, whole);
|
||||
|
||||
//trim the end '/' of each
|
||||
part = part.TrimEnd('/');
|
||||
whole = whole.TrimEnd('/');
|
||||
//ensure both have a / on the end
|
||||
part = part.EndsWith("/") ? part : part + "/";
|
||||
whole = whole.EndsWith("/") ? whole : whole + "/";
|
||||
if (part.Length >= whole.Length)
|
||||
return _stringComparer.Compare(part, whole);
|
||||
|
||||
|
||||
@@ -8,6 +8,13 @@ using umbraco.interfaces;
|
||||
|
||||
namespace Umbraco.Tests
|
||||
{
|
||||
|
||||
[TestFixture]
|
||||
public class GlobalSettingsTests
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
[TestFixture]
|
||||
public class ActionsResolverTests
|
||||
{
|
||||
|
||||
@@ -65,6 +65,8 @@ namespace Umbraco.Tests.Routing
|
||||
[TestCase("/base/somebasehandler", false)]
|
||||
[TestCase("/", true)]
|
||||
[TestCase("/home.aspx", true)]
|
||||
[TestCase("/umbraco-test", true)]
|
||||
[TestCase("/install-test", true)]
|
||||
public void Ensure_Request_Routable(string url, bool assert)
|
||||
{
|
||||
var httpContextFactory = new FakeHttpContextFactory(url);
|
||||
|
||||
Reference in New Issue
Block a user