From 262aa3b8fe7eb398cb1c2e258594add0d9ccce7a Mon Sep 17 00:00:00 2001 From: Stephan Date: Fri, 3 May 2013 20:09:14 -0200 Subject: [PATCH] Web.Routing, Web.Mvc - fix issues with content with no template --- src/Umbraco.Web/Mvc/RenderRouteHandler.cs | 12 +++++++++++- src/Umbraco.Web/Routing/PublishedContentRequest.cs | 3 +++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/src/Umbraco.Web/Mvc/RenderRouteHandler.cs b/src/Umbraco.Web/Mvc/RenderRouteHandler.cs index ddf6d9b618..0587d13dcd 100644 --- a/src/Umbraco.Web/Mvc/RenderRouteHandler.cs +++ b/src/Umbraco.Web/Mvc/RenderRouteHandler.cs @@ -101,6 +101,12 @@ namespace Umbraco.Web.Mvc requestContext.RouteData.DataTokens.Add("umbraco-context", UmbracoContext); //required for UmbracoTemplatePage } + private void UpdateRouteDataForRequest(RenderModel renderModel, RequestContext requestContext) + { + requestContext.RouteData.DataTokens["umbraco"] = renderModel; + // the rest should not change -- it's only the published content that has changed + } + /// /// Checks the request and query strings to see if it matches the definition of having a Surface controller /// posted value, if so, then we return a PostedDataProxyInfo object with the correct information. @@ -358,7 +364,11 @@ namespace Umbraco.Web.Mvc return handler; // else we are running Mvc - // update the route definition + // update the route data - because the PublishedContent has changed + UpdateRouteDataForRequest( + new RenderModel(publishedContentRequest.PublishedContent, publishedContentRequest.Culture), + requestContext); + // update the route definition routeDef = GetUmbracoRouteDefinition(requestContext, publishedContentRequest); } diff --git a/src/Umbraco.Web/Routing/PublishedContentRequest.cs b/src/Umbraco.Web/Routing/PublishedContentRequest.cs index 73e004faae..4eae420fed 100644 --- a/src/Umbraco.Web/Routing/PublishedContentRequest.cs +++ b/src/Umbraco.Web/Routing/PublishedContentRequest.cs @@ -66,7 +66,10 @@ namespace Umbraco.Web.Routing /// internal void UpdateOnMissingTemplate() { + var __readonly = _readonly; + _readonly = false; _engine.UpdateRequestOnMissingTemplate(); + _readonly = __readonly; } ///