Merge with 6.0.3
This commit is contained in:
@@ -154,6 +154,9 @@ namespace Umbraco.Core.Configuration
|
|||||||
/// This will return the MVC area that we will route all custom routes through like surface controllers, etc...
|
/// This will return the MVC area that we will route all custom routes through like surface controllers, etc...
|
||||||
/// We will use the 'Path' (default ~/umbraco) to create it but since it cannot contain '/' and people may specify a path of ~/asdf/asdf/admin
|
/// We will use the 'Path' (default ~/umbraco) to create it but since it cannot contain '/' and people may specify a path of ~/asdf/asdf/admin
|
||||||
/// we will convert the '/' to '-' and use that as the path. its a bit lame but will work.
|
/// we will convert the '/' to '-' and use that as the path. its a bit lame but will work.
|
||||||
|
///
|
||||||
|
/// We also make sure that the virtual directory (SystemDirectories.Root) is stripped off first, otherwise we'd end up with something
|
||||||
|
/// like "MyVirtualDirectory-Umbraco" instead of just "Umbraco".
|
||||||
/// </remarks>
|
/// </remarks>
|
||||||
internal static string UmbracoMvcArea
|
internal static string UmbracoMvcArea
|
||||||
{
|
{
|
||||||
@@ -163,7 +166,7 @@ namespace Umbraco.Core.Configuration
|
|||||||
{
|
{
|
||||||
throw new InvalidOperationException("Cannot create an MVC Area path without the umbracoPath specified");
|
throw new InvalidOperationException("Cannot create an MVC Area path without the umbracoPath specified");
|
||||||
}
|
}
|
||||||
return Path.TrimStart('~').TrimStart('/').Replace('/', '-').Trim();
|
return Path.TrimStart(SystemDirectories.Root).TrimStart('~').TrimStart('/').Replace('/', '-').Trim().ToLower();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -183,16 +183,26 @@ namespace Umbraco.Core.IO
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static string _root;
|
||||||
|
/// <summary>
|
||||||
|
/// Gets the root path of the application
|
||||||
|
/// </summary>
|
||||||
public static string Root
|
public static string Root
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
string appPath = HttpRuntime.AppDomainAppVirtualPath ?? string.Empty;
|
if (_root == null)
|
||||||
if (appPath == "/")
|
{
|
||||||
appPath = string.Empty;
|
string appPath = HttpRuntime.AppDomainAppVirtualPath ?? string.Empty;
|
||||||
|
if (appPath == "/")
|
||||||
|
appPath = string.Empty;
|
||||||
|
|
||||||
return appPath;
|
_root = appPath;
|
||||||
|
}
|
||||||
|
return _root;
|
||||||
}
|
}
|
||||||
|
//Only required for unit tests
|
||||||
|
internal set { _root = value; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ using System.Configuration;
|
|||||||
using System.Web.Routing;
|
using System.Web.Routing;
|
||||||
using NUnit.Framework;
|
using NUnit.Framework;
|
||||||
using Umbraco.Core.Configuration;
|
using Umbraco.Core.Configuration;
|
||||||
|
using Umbraco.Core.IO;
|
||||||
using Umbraco.Tests.TestHelpers;
|
using Umbraco.Tests.TestHelpers;
|
||||||
using System.Web.Mvc;
|
using System.Web.Mvc;
|
||||||
|
|
||||||
@@ -23,6 +24,9 @@ namespace Umbraco.Tests
|
|||||||
|
|
||||||
public override void TearDown()
|
public override void TearDown()
|
||||||
{
|
{
|
||||||
|
//ensure this is reset
|
||||||
|
SystemDirectories.Root = null;
|
||||||
|
SettingsForTests.UmbracoPath = "~/umbraco";
|
||||||
//reset the app config
|
//reset the app config
|
||||||
base.TearDown();
|
base.TearDown();
|
||||||
|
|
||||||
@@ -35,7 +39,19 @@ namespace Umbraco.Tests
|
|||||||
Assert.That(UmbracoVersion.Current.ToString(3), Is.EqualTo("6.0.0"));
|
Assert.That(UmbracoVersion.Current.ToString(3), Is.EqualTo("6.0.0"));
|
||||||
}
|
}
|
||||||
|
|
||||||
[TestCase("/umbraco/umbraco.aspx")]
|
[TestCase("~/umbraco", "/", "umbraco")]
|
||||||
|
[TestCase("~/umbraco", "/MyVirtualDir", "umbraco")]
|
||||||
|
[TestCase("~/customPath", "/MyVirtualDir/", "custompath")]
|
||||||
|
[TestCase("~/some-wacky/nestedPath", "/MyVirtualDir", "some-wacky-nestedpath")]
|
||||||
|
[TestCase("~/some-wacky/nestedPath", "/MyVirtualDir/NestedVDir/", "some-wacky-nestedpath")]
|
||||||
|
public void Umbraco_Mvc_Area(string path, string rootPath, string outcome)
|
||||||
|
{
|
||||||
|
SettingsForTests.UmbracoPath = path;
|
||||||
|
SystemDirectories.Root = rootPath;
|
||||||
|
Assert.AreEqual(outcome, Umbraco.Core.Configuration.GlobalSettings.UmbracoMvcArea);
|
||||||
|
}
|
||||||
|
|
||||||
|
[TestCase("/umbraco/umbraco.aspx")]
|
||||||
[TestCase("/umbraco/editContent.aspx")]
|
[TestCase("/umbraco/editContent.aspx")]
|
||||||
[TestCase("/install/default.aspx")]
|
[TestCase("/install/default.aspx")]
|
||||||
[TestCase("/install/")]
|
[TestCase("/install/")]
|
||||||
|
|||||||
@@ -2469,7 +2469,7 @@ xcopy "$(ProjectDir)"..\packages\SqlServerCE.4.0.0.0\x86\*.* "$(TargetDir)x86\"
|
|||||||
<AutoAssignPort>True</AutoAssignPort>
|
<AutoAssignPort>True</AutoAssignPort>
|
||||||
<DevelopmentServerPort>61637</DevelopmentServerPort>
|
<DevelopmentServerPort>61637</DevelopmentServerPort>
|
||||||
<DevelopmentServerVPath>/</DevelopmentServerVPath>
|
<DevelopmentServerVPath>/</DevelopmentServerVPath>
|
||||||
<IISUrl>http://localhost:61638/</IISUrl>
|
<IISUrl>http://localhost:61639/VirtualDir</IISUrl>
|
||||||
<NTLMAuthentication>False</NTLMAuthentication>
|
<NTLMAuthentication>False</NTLMAuthentication>
|
||||||
<UseCustomServer>False</UseCustomServer>
|
<UseCustomServer>False</UseCustomServer>
|
||||||
<CustomServerUrl>
|
<CustomServerUrl>
|
||||||
|
|||||||
@@ -51,7 +51,7 @@ namespace Umbraco.Web
|
|||||||
// see also VirtualPathUtility.ToAppRelative
|
// see also VirtualPathUtility.ToAppRelative
|
||||||
public static string ToAppRelative(string virtualPath)
|
public static string ToAppRelative(string virtualPath)
|
||||||
{
|
{
|
||||||
if (virtualPath.StartsWith(_appPathPrefix))
|
if (virtualPath.InvariantStartsWith(_appPathPrefix))
|
||||||
virtualPath = virtualPath.Substring(_appPathPrefix.Length);
|
virtualPath = virtualPath.Substring(_appPathPrefix.Length);
|
||||||
if (virtualPath.Length == 0)
|
if (virtualPath.Length == 0)
|
||||||
virtualPath = "/";
|
virtualPath = "/";
|
||||||
|
|||||||
Reference in New Issue
Block a user