mirror of
https://github.com/shlinkio/shlink.git
synced 2025-02-25 18:45:27 -06:00
Ensured domain is taken into account when generating QR codes
This commit is contained in:
@@ -59,8 +59,10 @@ class QrCodeAction implements MiddlewareInterface
|
|||||||
{
|
{
|
||||||
// Make sure the short URL exists for this short code
|
// Make sure the short URL exists for this short code
|
||||||
$shortCode = $request->getAttribute('shortCode');
|
$shortCode = $request->getAttribute('shortCode');
|
||||||
|
$domain = $request->getUri()->getAuthority();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$this->urlShortener->shortCodeToUrl($shortCode);
|
$this->urlShortener->shortCodeToUrl($shortCode, $domain);
|
||||||
} catch (InvalidShortCodeException | EntityDoesNotExistException $e) {
|
} catch (InvalidShortCodeException | EntityDoesNotExistException $e) {
|
||||||
$this->logger->warning('An error occurred while creating QR code. {e}', ['e' => $e]);
|
$this->logger->warning('An error occurred while creating QR code. {e}', ['e' => $e]);
|
||||||
return $this->buildErrorResponse($request, $handler);
|
return $this->buildErrorResponse($request, $handler);
|
||||||
|
|||||||
@@ -152,6 +152,7 @@ class UrlShortener implements UrlShortenerInterface
|
|||||||
if ($shortUrl === null) {
|
if ($shortUrl === null) {
|
||||||
throw EntityDoesNotExistException::createFromEntityAndConditions(ShortUrl::class, [
|
throw EntityDoesNotExistException::createFromEntityAndConditions(ShortUrl::class, [
|
||||||
'shortCode' => $shortCode,
|
'shortCode' => $shortCode,
|
||||||
|
'domain' => $domain,
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user