Skip to content

Commit 1f1e345

Browse files
authored
Only add path prefix if the path does not contain it already
1 parent 7533c2d commit 1f1e345

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/Plugin/AddPathPlugin.php

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,11 @@ public function __construct(UriInterface $uri)
3939
*/
4040
public function handleRequest(RequestInterface $request, callable $next, callable $first)
4141
{
42-
$request = $request->withUri($request->getUri()
43-
->withPath($this->uri->getPath().$request->getUri()->getPath())
44-
);
42+
if (strpos($request->getUri()->getPath(), $this->uri->getPath()) !== 0) {
43+
$request = $request->withUri($request->getUri()
44+
->withPath($this->uri->getPath().$request->getUri()->getPath())
45+
);
46+
}
4547

4648
return $next($request);
4749
}

0 commit comments

Comments
 (0)