Client icon indicating copy to clipboard operation
Client copied to clipboard

Repository branch compare doesn't work if the branch name contains slashes.

Open vekien opened this issue 8 months ago • 0 comments

Issue

If a branch name has slashes, the compare function does not work and throws an error

Replicate:

<?php

require __DIR__ . "/vendor/autoload.php";

use Gitlab\Client;

$client = new Client();
$client->setUrl("url");
$client->authenticate("token", Client::AUTH_HTTP_TOKEN);

$comparison = $client->repositories()->compare(
    123,
    "fix/branch_name",
    "develop"
);

print_r($comparison);

Thrown:

Fatal error: Uncaught Gitlab\Exception\RuntimeException: 404 Ref Not Found in gitlab-test/vendor/m4tthumphrey/php-gitlab-api/src/HttpClient/Plugin/ExceptionThrower.php:78
Stack trace:
#0 gitlab-test/vendor/m4tthumphrey/php-gitlab-api/src/HttpClient/Plugin/ExceptionThrower.php(53): Gitlab\HttpClient\Plugin\ExceptionThrower::createException(404, '404 Ref Not Fou...')

vekien avatar Feb 07 '25 13:02 vekien