Fix(OgRepository): fix repo deletion payload mismatch and error handling
ogcore-debian-package/pipeline/head This commit looks good Details
testing/ogcore-api/pipeline/head There was a failure building this commit Details

pull/125/head
Juan Manuel Bardallo 2026-07-28 11:02:37 +02:00
parent 7df739c17f
commit cd1f7c0f23
2 changed files with 8 additions and 4 deletions

View File

@ -15,11 +15,15 @@ class DeleteAction extends AbstractOgRepositoryController
{
public function __invoke(ImageRepository $repository, DeleteRepositoryInput $input): JsonResponse
{
$content = $this->createRequest('DELETE', 'http://'.$repository->getIp().':8006/ogrepository/v1/git/repositories/'.$input->repository, [
if (empty($input->repositoryName)) {
throw new BadRequestHttpException('Repository name is required');
}
$content = $this->createRequest('DELETE', 'http://'.$repository->getIp().':8006/ogrepository/v1/git/repositories/'.$input->repositoryName, [
]);
if (isset($content['error']) && $content['code'] === Response::HTTP_INTERNAL_SERVER_ERROR) {
throw new BadRequestHttpException('Error deleting repository');
if (isset($content['error'])) {
throw new BadRequestHttpException($content['details'] ?? $content['error']);
}
return new JsonResponse(data: [], status: Response::HTTP_OK);

View File

@ -9,5 +9,5 @@ final class DeleteRepositoryInput
{
#[Groups(['image-image-repository:write'])]
#[ApiProperty(description: 'The repository name', example: "")]
public ?string $repository = null;
public ?string $repositoryName = null;
}