Fixes: #U4-1727
This commit is contained in:
@@ -181,12 +181,11 @@ namespace Umbraco.Web.Mvc
|
||||
//set the standard route values/tokens
|
||||
requestContext.RouteData.Values["controller"] = postedInfo.ControllerName;
|
||||
requestContext.RouteData.Values["action"] = postedInfo.ActionName;
|
||||
requestContext.RouteData.DataTokens["area"] = postedInfo.Area;
|
||||
|
||||
IHttpHandler handler = new MvcHandler(requestContext);
|
||||
|
||||
//ensure the controllerType is set if found, meaning it is a plugin, not locally declared
|
||||
if (postedInfo.Area != standardArea)
|
||||
if (!postedInfo.Area.InvariantEquals(standardArea))
|
||||
{
|
||||
//requestContext.RouteData.Values["controllerType"] = postedInfo.ControllerType;
|
||||
//find the other data tokens for this route and merge... things like Namespace will be included here
|
||||
@@ -195,12 +194,15 @@ namespace Umbraco.Web.Mvc
|
||||
var surfaceRoute = RouteTable.Routes.OfType<Route>()
|
||||
.SingleOrDefault(x => x.Defaults != null &&
|
||||
x.Defaults.ContainsKey("controller") &&
|
||||
x.Defaults["controller"].ToString() == postedInfo.ControllerName &&
|
||||
x.Defaults["controller"].ToString().InvariantEquals(postedInfo.ControllerName) &&
|
||||
x.DataTokens.ContainsKey("area") &&
|
||||
x.DataTokens["area"].ToString() == postedInfo.Area);
|
||||
x.DataTokens["area"].ToString().InvariantEquals(postedInfo.Area));
|
||||
if (surfaceRoute == null)
|
||||
throw new InvalidOperationException("Could not find a Surface controller route in the RouteTable for controller name " + postedInfo.ControllerName + " and within the area of " + postedInfo.Area);
|
||||
//set the 'Namespaces' token so the controller factory knows where to look to construct it
|
||||
|
||||
requestContext.RouteData.DataTokens["area"] = surfaceRoute.DataTokens["area"];
|
||||
|
||||
//set the 'Namespaces' token so the controller factory knows where to look to construct it
|
||||
if (surfaceRoute.DataTokens.ContainsKey("Namespaces"))
|
||||
{
|
||||
requestContext.RouteData.DataTokens["Namespaces"] = surfaceRoute.DataTokens["Namespaces"];
|
||||
@@ -210,8 +212,6 @@ namespace Umbraco.Web.Mvc
|
||||
|
||||
}
|
||||
|
||||
//store the original URL this came in on
|
||||
requestContext.RouteData.DataTokens["umbraco-item-url"] = requestContext.HttpContext.Request.Url.AbsolutePath;
|
||||
//store the original route definition
|
||||
requestContext.RouteData.DataTokens["umbraco-route-def"] = routeDefinition;
|
||||
|
||||
|
||||
@@ -127,7 +127,7 @@ namespace Umbraco.Web
|
||||
//Create the REST/web/script service routes
|
||||
var webServiceRoutes = RouteTable.Routes.MapRoute(
|
||||
"Umbraco_web_services",
|
||||
"Umbraco/RestServices/{controller}/{action}/{id}",
|
||||
umbracoPath + "/RestServices/{controller}/{action}/{id}",
|
||||
new {controller = "SaveFileController", action = "Index", id = UrlParameter.Optional},
|
||||
//VERY IMPORTANT! for this route, only match controllers in this namespace!
|
||||
new string[] { "Umbraco.Web.WebServices" }
|
||||
|
||||
Reference in New Issue
Block a user