Skip to content

Commit fa6002b

Browse files
committed
FIX issue with current PR#9 - work with Slim3
1 parent 4032e27 commit fa6002b

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/PhpDebugBarMiddleware.php

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,13 +83,19 @@ private function getStaticFile(UriInterface $uri)
8383
return;
8484
}
8585

86-
$pathToFile = substr($uri->getPath(), strlen($this->debugBarRenderer->getBaseUrl()));
86+
if (empty($uri->getBasePath())) {
87+
return;
88+
}
89+
90+
$path = $uri->getBasePath() ?: $uri->getPath();
91+
$pathToFile = substr($path, strlen($this->debugBarRenderer->getBaseUrl()));
8792

8893
$fullPathToFile = $this->debugBarRenderer->getBasePath() . $pathToFile;
8994

9095
if (!file_exists($fullPathToFile)) {
9196
return;
9297
}
98+
$fullPathToFile = str_replace('/', DIRECTORY_SEPARATOR, $fullPathToFile);
9399

94100
$stream = new Stream($fullPathToFile, 'r');
95101
$staticResponse = new Response($stream);

0 commit comments

Comments
 (0)