Skip to content

Commit

Permalink
Merge branch 'release/1.3.2'
Browse files Browse the repository at this point in the history
  • Loading branch information
kayalion committed Sep 16, 2016
2 parents bdb991a + a96613d commit 76d8cb3
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
12 changes: 9 additions & 3 deletions src/ride/library/router/Route.php
Original file line number Diff line number Diff line change
Expand Up @@ -157,11 +157,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
1 change: 1 addition & 0 deletions test/src/ride/library/router/RouteTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ public function providerConstruct() {
return array(
array('/path', 'path'),
array('///admin', '///admin'),
array('/', '/'),
);
}

Expand Down

0 comments on commit 76d8cb3

Please sign in to comment.