Skip to content
This repository has been archived by the owner on Dec 13, 2022. It is now read-only.

Commit

Permalink
compare http method
Browse files Browse the repository at this point in the history
  • Loading branch information
kduret committed Aug 3, 2022
1 parent eed86cd commit 42a5560
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/EventSubscriber/UpdateEventSubscriber.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@

use Symfony\Component\HttpKernel\KernelEvents;
use Symfony\Component\HttpKernel\Event\RequestEvent;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
use Centreon\Domain\Log\LoggerTrait;
use Core\Platform\Application\Repository\ReadVersionRepositoryInterface;
Expand Down Expand Up @@ -59,11 +60,12 @@ public static function getSubscribedEvents(): array
* @param RequestEvent $event
* @throws \Exception
*/
public function validateCentreonWebVersionOrFail(RequestEvent $event)
public function validateCentreonWebVersionOrFail(RequestEvent $event): void
{
$this->debug('Checking if route matches updates endpoint');
if (
preg_match(
$event->getRequest()->getMethod() === Request::METHOD_PATCH
&& preg_match(
'#^.*/api/(?:latest|beta|v[0-9]+|v[0-9]+\.[0-9]+)/platform/updates$#',
$event->getRequest()->getPathInfo(),
)
Expand Down

0 comments on commit 42a5560

Please sign in to comment.