mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2026-02-09 09:16:41 +08:00
Use TrimStart rather than a loop to remove leading slashes in autoroute driver.
This commit is contained in:
@@ -81,9 +81,9 @@ namespace Orchard.Autoroute.Drivers {
|
||||
var previous = part.DisplayAlias;
|
||||
if (updater != null && updater.TryUpdateModel(viewModel, Prefix, null, null)) {
|
||||
|
||||
// remove any trailing slash in the permalink
|
||||
while(!string.IsNullOrEmpty(viewModel.CurrentUrl) && viewModel.CurrentUrl.StartsWith("/")) {
|
||||
viewModel.CurrentUrl = viewModel.CurrentUrl.Substring(1);
|
||||
// remove any leading slash in the permalink
|
||||
if (viewModel.CurrentUrl != null) {
|
||||
viewModel.CurrentUrl = viewModel.CurrentUrl.TrimStart('/');
|
||||
}
|
||||
|
||||
part.DisplayAlias = viewModel.CurrentUrl;
|
||||
|
||||
Reference in New Issue
Block a user