From 3861ecf41da423da3fd4b73657f7db9db5875a07 Mon Sep 17 00:00:00 2001 From: hartvig Date: Mon, 25 Oct 2010 12:09:38 +0000 Subject: [PATCH] Fixes 19818 and implements 29257. Issues with NiceUrl and NEW configuration option to add trailing slash to urls [TFS Changeset #78909] --- .../config/umbracoSettings.config | 2 ++ umbraco/businesslogic/UmbracoSettings.cs | 29 +++++++++++++++++++ umbraco/presentation/library.cs | 2 ++ 3 files changed, 33 insertions(+) diff --git a/config templates/config/umbracoSettings.config b/config templates/config/umbracoSettings.config index 030d64bcfa..a64f3c6b50 100644 --- a/config templates/config/umbracoSettings.config +++ b/config templates/config/umbracoSettings.config @@ -73,6 +73,8 @@ false + + true - diff --git a/umbraco/businesslogic/UmbracoSettings.cs b/umbraco/businesslogic/UmbracoSettings.cs index 4df3d5f30c..6f5d1f0688 100644 --- a/umbraco/businesslogic/UmbracoSettings.cs +++ b/umbraco/businesslogic/UmbracoSettings.cs @@ -229,6 +229,35 @@ namespace umbraco } } + /// + /// This will add a trailing slash (/) to urls when in directory url mode + /// NOTICE: This will always return false if Directory Urls in not active + /// + public static bool AddTrailingSlash + { + get + { + try + { + if (GlobalSettings.UseDirectoryUrls) + { + bool result; + if (bool.TryParse(GetKey("/settings/requestHandler/addTrailingSlash"), out result)) + return result; + return false; + } + else + { + return false; + } + } + catch + { + return false; + } + } + } + /// /// Gets a value indicating whether umbraco will use ASP.NET MasterPages for rendering instead of its propriatary templating system. /// diff --git a/umbraco/presentation/library.cs b/umbraco/presentation/library.cs index 3bdd530eb2..b5ed0a2623 100644 --- a/umbraco/presentation/library.cs +++ b/umbraco/presentation/library.cs @@ -564,6 +564,8 @@ namespace umbraco else { tempUrl = baseUrl + tempUrl; + if (UmbracoSettings.AddTrailingSlash) + tempUrl += "/"; } return tempUrl; }