Skip to content

Commit 3815859

Browse files
committed
make basePath more consistent
1 parent acd810b commit 3815859

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

api.php

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6765,7 +6765,7 @@ class SimpleRouter implements Router
67656765

67666766
public function __construct(string $basePath, Responder $responder, Cache $cache, int $ttl, bool $debug)
67676767
{
6768-
$this->basePath = $this->detectBasePath($basePath);
6768+
$this->basePath = rtrim($this->detectBasePath($basePath), '/');
67696769
$this->responder = $responder;
67706770
$this->cache = $cache;
67716771
$this->ttl = $ttl;
@@ -6850,9 +6850,8 @@ private function getRouteNumbers(ServerRequestInterface $request): array
68506850
private function removeBasePath(ServerRequestInterface $request): ServerRequestInterface
68516851
{
68526852
$path = $request->getUri()->getPath();
6853-
$basePath = rtrim($this->basePath, '/');
6854-
if (substr($path, 0, strlen($basePath)) == $basePath) {
6855-
$path = substr($path, strlen($basePath));
6853+
if (substr($path, 0, strlen($this->basePath)) == $this->basePath) {
6854+
$path = substr($path, strlen($this->basePath));
68566855
$request = $request->withUri($request->getUri()->withPath($path));
68576856
}
68586857
return $request;

0 commit comments

Comments
 (0)