Permalink
Browse files

Fixes an issue with prefixes in mapped Resources when entering a pref…

…ix without leading and trailing slash
  • Loading branch information...
thomasvnl committed Dec 5, 2013
1 parent abe420c commit dfa7e21c680dbdcd0591e1708fad44dc18fa489d
Showing with 13 additions and 0 deletions.
  1. +13 −0 lib/Cake/Routing/Router.php
@@ -497,6 +497,19 @@ public static function namedConfig() {
*/
public static function mapResources($controller, $options = array()) {
$hasPrefix = isset($options['prefix']);
if( $hasPrefix )
{
if( strpos( $options['prefix'], '/' ) !== 0 )
{
$options['prefix'] = '/' . $options['prefix'];
}
if( strcasecmp(substr( $options['prefix'], -1 ), '/' ) !== 0 )
{
$options['prefix'] = $options['prefix'] . '/';
}
}
$options = array_merge(array(
'prefix' => '/',
'id' => self::ID . '|' . self::UUID

0 comments on commit dfa7e21

Please sign in to comment.