Permalink
Browse files

Merge pull request #965 from garrett-eclipse/415-fix-urlencode

415: Avoid URLENCODE on the double slash paths
  • Loading branch information...
toolstack committed Oct 31, 2018
2 parents 65d83f4 + fa43d30 commit aaa4306138b4c8e9fb619c29deac0aecb28fd5d6
Showing with 3 additions and 3 deletions.
  1. +3 −3 gp-includes/url.php
View
@@ -146,14 +146,14 @@ function gp_url_current() {
* @return string
*/
function gp_url_project( $project_or_path = '', $path = '', $query = null ) {
$project_path = urlencode( is_object( $project_or_path ) ? $project_or_path->path : $project_or_path );
$project_path = is_object( $project_or_path ) ? $project_or_path->path : $project_or_path;
// A leading double-slash will avoid prepending /projects/ to the path.
// This was introduced to enable linking to the locale glossary.
if ( '//' === substr( $project_path, 0, 2 ) ) {
$project_path = ltrim( $project_path, '/' );
$project_path = urlencode( ltrim( $project_path, '/' ) );
} else {
$project_path = array( 'projects', $project_path );
$project_path = array( 'projects', urlencode( $project_path ) );
}
return gp_url( array( $project_path, $path ), $query );

0 comments on commit aaa4306

Please sign in to comment.