summaryrefslogtreecommitdiff
path: root/src/Server/RequestHandlers/DocumentServer.php
diff options
context:
space:
mode:
authorDaniel Weipert <git@mail.dweipert.de>2023-12-19 01:07:52 +0100
committerDaniel Weipert <git@mail.dweipert.de>2023-12-19 01:07:52 +0100
commit878b3e840ec0a02901c9e3fb33ed0837813aaeac (patch)
tree698aa1276110575e4deca8afca62be384a80a245 /src/Server/RequestHandlers/DocumentServer.php
parent10a7516603d50a7b094ae5ff0102d018b11d7c5f (diff)
[DocumentServer] replace custom trim with rtrim
Diffstat (limited to 'src/Server/RequestHandlers/DocumentServer.php')
-rw-r--r--src/Server/RequestHandlers/DocumentServer.php7
1 files changed, 1 insertions, 6 deletions
diff --git a/src/Server/RequestHandlers/DocumentServer.php b/src/Server/RequestHandlers/DocumentServer.php
index e55a891..0b1f2ae 100644
--- a/src/Server/RequestHandlers/DocumentServer.php
+++ b/src/Server/RequestHandlers/DocumentServer.php
@@ -27,7 +27,7 @@ class DocumentServer implements RequestHandlerInterface
public function __invoke(Response $response, Request $request): Response
{
- $requestPath = $this->trim(urldecode($request->getPath()));
+ $requestPath = rtrim(urldecode($request->getPath()), '/');
$filePath = $this->documentRoot . $requestPath;
$documentPath = $filePath;
@@ -57,9 +57,4 @@ class DocumentServer implements RequestHandlerInterface
return $response;
}
-
- private function trim(string $string)
- {
- return str_ends_with($string, '/') ? substr($string, offset: 0, length: -1) : $string;
- }
}