Used league/uri to validate URLs including deeplinks, and fixed tests

This commit is contained in:
Alejandro Celaya
2020-06-27 11:09:56 +02:00
parent 08950f6433
commit 78b838f6b6
7 changed files with 13 additions and 17 deletions

View File

@@ -5,7 +5,7 @@ declare(strict_types=1);
namespace Shlinkio\Shlink\Core\Action;
use Fig\Http\Message\RequestMethodInterface;
use Laminas\Diactoros\Uri;
use League\Uri\Uri;
use Mezzio\Router\Middleware\ImplicitHeadMiddleware;
use Psr\Http\Message\ResponseInterface;
use Psr\Http\Message\ServerRequestInterface;
@@ -67,7 +67,7 @@ abstract class AbstractTrackingAction implements MiddlewareInterface, RequestMet
private function buildUrlToRedirectTo(ShortUrl $shortUrl, array $currentQuery, ?string $disableTrackParam): string
{
$uri = new Uri($shortUrl->getLongUrl());
$uri = Uri::createFromString($shortUrl->getLongUrl());
$hardcodedQuery = parse_query($uri->getQuery());
if ($disableTrackParam !== null) {
unset($currentQuery[$disableTrackParam]);