fix: Guzzle base_uri resolution for Gitea API paths
Strip leading slash from endpoints and ensure base_uri has trailing slash so Guzzle preserves the /api/v1 path prefix per RFC 3986. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -24,7 +24,7 @@
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
require_once __DIR__ . '/../../vendor/autoload.php';
|
||||
require_once __DIR__ . '/../vendor/autoload.php';
|
||||
require_once __DIR__ . '/../lib/Enterprise/CliFramework.php';
|
||||
|
||||
use MokoEnterprise\{
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
require_once __DIR__ . '/../../vendor/autoload.php';
|
||||
require_once __DIR__ . '/../vendor/autoload.php';
|
||||
require_once __DIR__ . '/../lib/Enterprise/CliFramework.php';
|
||||
|
||||
use MokoEnterprise\{
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
require_once __DIR__ . '/../../vendor/autoload.php';
|
||||
require_once __DIR__ . '/../vendor/autoload.php';
|
||||
|
||||
use MokoEnterprise\CheckpointManager;
|
||||
use MokoEnterprise\CliFramework;
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
require_once __DIR__ . '/../../vendor/autoload.php';
|
||||
require_once __DIR__ . '/../vendor/autoload.php';
|
||||
require_once __DIR__ . '/../lib/Enterprise/CliFramework.php';
|
||||
|
||||
use MokoEnterprise\{
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
require_once __DIR__ . '/../../vendor/autoload.php';
|
||||
require_once __DIR__ . '/../vendor/autoload.php';
|
||||
require_once __DIR__ . '/../lib/Enterprise/CliFramework.php';
|
||||
|
||||
use MokoEnterprise\{ApiClient, AuditLogger, CLIApp, Config, GitPlatformAdapter, MetricsCollector, PlatformAdapterFactory};
|
||||
|
||||
@@ -166,7 +166,7 @@ class ApiClient
|
||||
|
||||
// Initialize HTTP client
|
||||
$this->httpClient = new Client([
|
||||
'base_uri' => $this->baseUrl,
|
||||
'base_uri' => rtrim($this->baseUrl, '/') . '/',
|
||||
'timeout' => 30,
|
||||
'headers' => [
|
||||
'User-Agent' => $this->userAgent,
|
||||
@@ -281,6 +281,9 @@ class ApiClient
|
||||
// Check rate limit
|
||||
$this->checkRateLimit();
|
||||
|
||||
// Ensure endpoint is relative so Guzzle base_uri path is preserved
|
||||
$endpoint = ltrim($endpoint, '/');
|
||||
|
||||
// Add authentication
|
||||
if ($this->authToken) {
|
||||
$options['headers']['Authorization'] = $this->authScheme . ' ' . $this->authToken;
|
||||
|
||||
Reference in New Issue
Block a user