From 24352cc2c8f83be147a34683b11056229b2fabe6 Mon Sep 17 00:00:00 2001 From: Manuel Aranda Date: Wed, 12 Mar 2025 09:05:04 +0100 Subject: [PATCH] Updated and fixed cancel P2p transmission --- .../OgRepository/Image/CancelTransmissionAction.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/Controller/OgRepository/Image/CancelTransmissionAction.php b/src/Controller/OgRepository/Image/CancelTransmissionAction.php index eec94f2..9d79b51 100644 --- a/src/Controller/OgRepository/Image/CancelTransmissionAction.php +++ b/src/Controller/OgRepository/Image/CancelTransmissionAction.php @@ -8,6 +8,7 @@ use App\Entity\Image; use App\Entity\ImageImageRepository; use App\Entity\Trace; use App\Model\CommandTypes; +use App\Model\DeployMethodTypes; use App\Model\TraceStatus; use Symfony\Component\HttpFoundation\JsonResponse; use Symfony\Component\HttpFoundation\Response; @@ -52,7 +53,11 @@ class CancelTransmissionAction extends AbstractOgRepositoryController throw new ValidatorException('Fullsum is required'); } - $content = $this->createRequest('DELETE', 'http://'.$image->getRepository()->getIp().':8006/ogrepository/v1/'.$method.'/images/'.$image->getImageFullsum()); + if ($method === DeployMethodTypes::TORRENT) { + $content = $this->createRequest('DELETE', 'http://'.$image->getRepository()->getIp().':8006/ogrepository/v1/p2p'); + } else { + $content = $this->createRequest('DELETE', 'http://'.$image->getRepository()->getIp().':8006/ogrepository/v1/'.$method.'/images/'.$image->getImageFullsum()); + } if (isset($content['error']) && $content['error'] === Response::HTTP_INTERNAL_SERVER_ERROR ) { throw new ValidatorException('Error cancelling transmission');