From a445a574f0f53ce484b4f3c2bdf46b24f24963df Mon Sep 17 00:00:00 2001 From: Tim Steiner <tsteiner2@unl.edu> Date: Tue, 29 Jun 2010 17:28:23 +0000 Subject: [PATCH] Fix importing menu links that end with a trailing slash. git-svn-id: file:///tmp/wdn_thm_drupal/branches/drupal-7.x@111 20a16fea-79d4-4915-8869-1ea9d5ebf173 --- sites/all/modules/unl/unl_migration.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/sites/all/modules/unl/unl_migration.php b/sites/all/modules/unl/unl_migration.php index f4c76759..6d0f062f 100644 --- a/sites/all/modules/unl/unl_migration.php +++ b/sites/all/modules/unl/unl_migration.php @@ -209,6 +209,9 @@ class Unl_Migration_Tool } if ($fragmentPos = strrpos($path, '#') !== FALSE) { $path = substr($path, 0, $fragmentPos); + } + if (substr($path, -1) == '/') { + $path = substr($path, 0, -1); } $nodeId = array_search($path, $this->_nodeMap, TRUE); $item['link_path'] = 'node/' . $nodeId; @@ -239,9 +242,11 @@ class Unl_Migration_Tool $path = ''; } if (($fragmentPos = strrpos($path, '#')) !== FALSE) { - echo "strrpos() = $fragmentPos\n"; $path = substr($path, 0, $fragmentPos); } + if (substr($path, -1) == '/') { + $path = substr($path, 0, -1); + } $nodeId = array_search($path, $this->_nodeMap, TRUE); $item['link_path'] = 'node/' . $nodeId; echo '[' . $nodeId . '] => ' . $path . PHP_EOL; -- GitLab