#20848: Preventing unintentional empty slugs

Work Items: 20848
This commit is contained in:
Sebastien Ros
2014-08-25 15:20:43 -07:00
parent 52b0367cdf
commit d7fded7ce9

View File

@@ -80,6 +80,13 @@ namespace Orchard.Autoroute.Handlers {
part.DisplayAlias = _autorouteService.Value.GenerateAlias(part);
}
// if the generated alias is empty, compute a new one
if (String.IsNullOrWhiteSpace(part.DisplayAlias)) {
_autorouteService.Value.ProcessPath(part);
_orchardServices.Notifier.Warning(T("The permalink could not be generated, a new slug has been defined: \"{0}\"", part.Path));
return;
}
// should it become the home page ?
if (part.DisplayAlias != "/" && _orchardServices.Authorizer.Authorize(Permissions.SetHomePage)) {
// if it's the current home page, do nothing