From c49e37870671676933bb275ede8d5a58d7ce1bf4 Mon Sep 17 00:00:00 2001 From: Nils Adermann Date: Mon, 11 Dec 2017 13:29:47 +0100 Subject: [PATCH] Do not prepend api/vX/ to the path if it already starts that way, e.g. pagination next URLs --- lib/Github/HttpClient/Plugin/PathPrepend.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/Github/HttpClient/Plugin/PathPrepend.php b/lib/Github/HttpClient/Plugin/PathPrepend.php index b3b840e1487..567bb156ed7 100644 --- a/lib/Github/HttpClient/Plugin/PathPrepend.php +++ b/lib/Github/HttpClient/Plugin/PathPrepend.php @@ -28,7 +28,9 @@ public function __construct($path) public function handleRequest(RequestInterface $request, callable $next, callable $first) { $currentPath = $request->getUri()->getPath(); - $uri = $request->getUri()->withPath($this->path.$currentPath); + if (strpos($currentPath, $this->path) !== 0) { + $uri = $request->getUri()->withPath($this->path.$currentPath); + } $request = $request->withUri($uri);