From bc1f9273da86e86359fd3052f78afd2ddf5dbc96 Mon Sep 17 00:00:00 2001 From: Kevin Paxman <kpaxman@uwaterloo.ca> Date: Thu, 20 Oct 2022 17:48:33 -0400 Subject: [PATCH] ISTWCMS-5866: only strip surrounding slashes so aliases like bl/og can work --- uw_cfg_common.module | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/uw_cfg_common.module b/uw_cfg_common.module index 58b2ee4c..cebb0e05 100644 --- a/uw_cfg_common.module +++ b/uw_cfg_common.module @@ -939,7 +939,7 @@ function uw_cfg_common_form_alter(array &$form, FormStateInterface $form_state, */ function _uw_cfg_common_alias_validate(array &$form, FormStateInterface $form_state): void { - // List of urls which should not be repeat in alias. + // List of urls which should not be an alias. $urls = [ 'blog', 'events', @@ -959,12 +959,12 @@ function _uw_cfg_common_alias_validate(array &$form, FormStateInterface $form_st // Get the alias from the form state values. $alias = $values['path'][0]['alias']; - // We want to remove all the slashes from the alias to + // Trim any surrounding slashes from the alias to // ensure that we are getting exact matches for the // predefined alias from above. Some users will add // slashes before and after the alias, so just // easier to check without slashes. - $alias = str_replace('/', '', $alias); + $alias = trim($alias, '/'); // Check if the alias exists if yes, sets error. // We are checking three cases, the first is if -- GitLab