mirror of
https://github.com/shlinkio/shlink.git
synced 2026-03-10 01:03:13 +08:00
Removed hardcoded route names for core routes and used action class names instead
This commit is contained in:
@@ -68,7 +68,7 @@ class QrCodeAction implements MiddlewareInterface
|
||||
return $this->buildErrorResponse($request, $handler);
|
||||
}
|
||||
|
||||
$path = $this->router->generateUri('long-url-redirect', ['shortCode' => $shortCode]);
|
||||
$path = $this->router->generateUri(RedirectAction::class, ['shortCode' => $shortCode]);
|
||||
$size = $this->getSizeParam($request);
|
||||
|
||||
$qrCode = new QrCode((string) $request->getUri()->withPath($path)->withQuery(''));
|
||||
|
||||
@@ -9,6 +9,7 @@ use InvalidArgumentException;
|
||||
use Psr\Http\Message\ResponseInterface;
|
||||
use Psr\Http\Message\ServerRequestInterface;
|
||||
use Psr\Http\Server\RequestHandlerInterface;
|
||||
use Shlinkio\Shlink\Core\Action\RedirectAction;
|
||||
use Shlinkio\Shlink\Core\Options\NotFoundRedirectOptions;
|
||||
use Zend\Diactoros\Response;
|
||||
use Zend\Expressive\Router\RouteResult;
|
||||
@@ -91,7 +92,7 @@ class NotFoundHandler implements RequestHandlerInterface
|
||||
|
||||
if (
|
||||
$routeResult->isSuccess() &&
|
||||
$routeResult->getMatchedRouteName() === 'long-url-redirect' &&
|
||||
$routeResult->getMatchedRouteName() === RedirectAction::class &&
|
||||
$this->redirectOptions->hasInvalidShortUrlRedirect()
|
||||
) {
|
||||
return new Response\RedirectResponse($this->redirectOptions->getInvalidShortUrlRedirect());
|
||||
|
||||
Reference in New Issue
Block a user