From 878b3e840ec0a02901c9e3fb33ed0837813aaeac Mon Sep 17 00:00:00 2001 From: Daniel Weipert Date: Tue, 19 Dec 2023 01:07:52 +0100 Subject: [DocumentServer] replace custom trim with rtrim --- src/Server/RequestHandlers/DocumentServer.php | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) (limited to 'src/Server/RequestHandlers') 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; - } } -- cgit v1.2.3