Remove FixupMondeDiplomatiqueUriSubscriber

This commit is contained in:
Yassine Guedidi
2024-12-07 18:16:40 +01:00
parent 0fda16e8ff
commit 698cf8a026
3 changed files with 0 additions and 129 deletions

View File

@ -1,33 +0,0 @@
<?php
namespace Wallabag\Guzzle;
use GuzzleHttp\Event\CompleteEvent;
use GuzzleHttp\Event\SubscriberInterface;
/**
* Fixes url encoding of a parameter guzzle fails with.
*/
class FixupMondeDiplomatiqueUriSubscriber implements SubscriberInterface
{
public function getEvents(): array
{
return ['complete' => [['fixUri', 500]]];
}
public function fixUri(CompleteEvent $event)
{
$response = $event->getResponse();
if (!$response->hasHeader('Location')) {
return;
}
$uri = $response->getHeader('Location');
if (false === ($badParameter = strstr($uri, 'retour=http://'))) {
return;
}
$response->setHeader('Location', str_replace($badParameter, urlencode($badParameter), $uri));
}
}