Skip to content

Commit

Permalink
fixed trimming of path
Browse files Browse the repository at this point in the history
  • Loading branch information
kayalion committed Sep 27, 2016
1 parent a27ac7b commit ba6bf9d
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions src/ride/library/router/Route.php
Original file line number Diff line number Diff line change
Expand Up @@ -149,10 +149,17 @@ protected function setPath($path) {
throw new RouterException('Could not set the path of the route: ' . $path . ' is not a valid HTTP path');
}

if (substr($path, 0, 1) != '/') {
$path = '/' . $path;
if ($path !== '/') {
if (substr($path, 0, 1) !== '/') {
$path = '/' . $path;
}

if (substr($path, -1) === '/') {
$path = substr($path, 0, -1);
}
}
$this->path = rtrim($path, '/');

$this->path = $path;
}

/**
Expand Down

0 comments on commit ba6bf9d

Please sign in to comment.