Fixes: #U4-1170 - template with hyphen or dash

This commit is contained in:
Shannon Deminick
2013-01-29 21:19:16 +06:00
parent 5dc80c55b2
commit f9977a9fd8

View File

@@ -271,9 +271,10 @@ namespace Umbraco.Web.Mvc
// to the index Action
if (publishedContentRequest.HasTemplate)
{
//check if the custom controller has an action with the same name as the template name (we convert ToUmbracoAlias since the template name might have invalid chars).
//NOTE: This also means that all custom actions MUST be PascalCase.. but that should be standard.
var templateName = publishedContentRequest.Template.Alias.Split('.')[0].ToUmbracoAlias(StringAliasCaseType.PascalCase);
//the template Alias should always be already saved with a safe name.
//if there are hyphens in the name and there is a hijacked route, then the Action will need to be attributed
// with the action name attribute.
var templateName = publishedContentRequest.Template.Alias.Split('.')[0];
def.ActionName = templateName;
}