mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2025-09-23 04:43:35 +08:00
Refactoring permalink redirection based on reviews
--HG-- branch : 1.x
This commit is contained in:
@@ -299,13 +299,13 @@ namespace Orchard.Core.Contents.Controllers {
|
|||||||
|
|
||||||
// store the previous route in case a back redirection is requested
|
// store the previous route in case a back redirection is requested
|
||||||
string previousRoute = null;
|
string previousRoute = null;
|
||||||
var route = contentItem.As<RoutePart>();
|
if(contentItem.Has<RoutePart>()
|
||||||
if(route != null
|
|
||||||
&&!string.IsNullOrWhiteSpace(returnUrl)
|
&&!string.IsNullOrWhiteSpace(returnUrl)
|
||||||
&& Url.IsLocalUrl(returnUrl)
|
&& Url.IsLocalUrl(returnUrl)
|
||||||
&& returnUrl == Url.ItemDisplayUrl(contentItem) // only if the original returnUrl is the content itself
|
// only if the original returnUrl is the content itself
|
||||||
|
&& String.Equals(returnUrl, Url.ItemDisplayUrl(contentItem), StringComparison.OrdinalIgnoreCase)
|
||||||
) {
|
) {
|
||||||
previousRoute = route.Path;
|
previousRoute = contentItem.As<RoutePart>().Path;
|
||||||
}
|
}
|
||||||
|
|
||||||
dynamic model = _contentManager.UpdateEditor(contentItem, this);
|
dynamic model = _contentManager.UpdateEditor(contentItem, this);
|
||||||
@@ -320,7 +320,7 @@ namespace Orchard.Core.Contents.Controllers {
|
|||||||
// did the route change ?
|
// did the route change ?
|
||||||
if (!string.IsNullOrWhiteSpace(returnUrl)
|
if (!string.IsNullOrWhiteSpace(returnUrl)
|
||||||
&& previousRoute != null
|
&& previousRoute != null
|
||||||
&& contentItem.As<RoutePart>().Path != previousRoute) {
|
&& !String.Equals(contentItem.As<RoutePart>().Path, previousRoute, StringComparison.OrdinalIgnoreCase)) {
|
||||||
returnUrl = Url.ItemDisplayUrl(contentItem);
|
returnUrl = Url.ItemDisplayUrl(contentItem);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user