Skip to content

Commit

Permalink
Merge pull request #1154 from glye/ezp-24141_class_edit_double_slash
Browse files Browse the repository at this point in the history
Fix EZP-24141: Double slash in url after having searched a default locat...
  • Loading branch information
glye committed Mar 30, 2015
2 parents 62d5c96 + 895f414 commit b302114
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion lib/ezutils/classes/ezmodule.php
Original file line number Diff line number Diff line change
Expand Up @@ -857,14 +857,17 @@ function redirectionURIForModule( $module, $viewName, $parameters = array(),
$uri .= $unorderedURI;
}

if ( is_array( $userParameters ) )
if ( !empty( $userParameters ) && is_array( $userParameters ) )
{
// Remove any slash(es) at the end of the uri, because the user params are appended with a leading slash
$uri = preg_replace( "#(^.*)(/+)$#", "\$1", $uri );
foreach ( $userParameters as $name => $value )
{
$uri .= '/(' . $name . ')/' . $value;
}
}

// Remove multiple slashes at the end of the uri
$uri = preg_replace( "#(^.*)(//+)$#", "\$1", $uri );
if ( $anchor !== false )
$uri .= '#' . urlencode( $anchor );
Expand Down

0 comments on commit b302114

Please sign in to comment.