diff --git a/globalredirect.module b/globalredirect.module index 34f5310..8cf2c2b 100644 --- a/globalredirect.module +++ b/globalredirect.module @@ -121,7 +121,7 @@ function globalredirect_init() { case 1 : // If last 2 characters of URL are /0 then trim them off if (drupal_substr($current_path, -2) == '/0') { - $current_path = rtrim($current_path, '/0'); + $current_path = drupal_substr($request, 0, -2); } } diff --git a/globalredirect.test b/globalredirect.test index c24b92a..4b507e6 100644 --- a/globalredirect.test +++ b/globalredirect.test @@ -165,6 +165,13 @@ class GlobalRedirectTestCase extends DrupalWebTestCase { 'return-code' => $settings['trailing_zero'] > 0 ? 301 : 200, 'expected-path' => $settings['trailing_zero'] > 0 ? 'test-term' : 'taxonomy/term/2/0', ), + + // Regression test for http://drupal.org/node/867654 + array( + 'request' => 'taxonomy/term/10/0', + 'return-code' => $settings['trailing_zero'] ? 301 : 404, // Term 10 does not exist in testing. + 'expected-path' => $settings['trailing_zero'] ? 'taxonomy/term/10' : 'taxonomy/term/10/0', + ), ); }