Fixes: U4-5291 UmbracoVirtualNodeRouteHandler throws exception: parameter culture cannot be null and publicizes some routing extensions.

This commit is contained in:
Shannon
2014-08-15 12:47:50 -06:00
parent 0fd37d708d
commit 4fe029a695
3 changed files with 36 additions and 5 deletions

View File

@@ -1,4 +1,6 @@
using System.Web;
using System.Globalization;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using System.Web.Routing;
using Umbraco.Core.Models;
@@ -42,6 +44,13 @@ namespace Umbraco.Web.Mvc
protected virtual void PreparePublishedContentRequest(PublishedContentRequest publishedContentRequest)
{
//need to set the culture for this to work
if (publishedContentRequest.Culture == null)
{
//none specified so get the default
var defaultLanguage = global::umbraco.cms.businesslogic.language.Language.GetAllAsList().FirstOrDefault();
publishedContentRequest.Culture = defaultLanguage == null ? CultureInfo.CurrentUICulture : new CultureInfo(defaultLanguage.CultureAlias);
}
}
}
}