fix(provider): dedoupet base URL is properly formatted in GitLab and Gitea providers

This commit is contained in:
2026-07-08 06:50:25 +02:00
parent f52a3449c6
commit 5e27a5bc93
2 changed files with 19 additions and 17 deletions
+8 -6
View File
@@ -26,7 +26,9 @@ final class GiteaProvider implements ProviderInterface
private readonly string $token,
private readonly string $baseUrl,
private readonly LoggerInterface $logger,
) {}
) {
$this->baseUrl = rtrim($this->baseUrl, '/');
}
public function getName(): string
{
@@ -40,20 +42,20 @@ final class GiteaProvider implements ProviderInterface
public function ping(): void
{
$baseUrl = rtrim($this->baseUrl, '/');
$this->client->request('GET', "$baseUrl/api/v1/user", [
$this->client->request('GET', "$this->baseUrl/api/v1/user", [
'headers' => ['Authorization' => "token {$this->token}"],
])->getContent();
}
public function startFetch(): ResponseInterface
{
$baseUrl = rtrim($this->baseUrl, '/');
$this->logger->debug('GiteaProvider: fetching contributions', ['user' => $this->username, 'url' => $baseUrl]);
$this->logger->debug('GiteaProvider: fetching contributions', ['user' => $this->username, 'url' => $this->baseUrl]);
return $this->client->request('GET', "$baseUrl/api/v1/users/{$this->username}/heatmap", [
return $this->client->request('GET', "$this->baseUrl/api/v1/users/{$this->username}/heatmap", [
'headers' => ['Authorization' => "token {$this->token}"],
]);
}