mirror of
https://github.com/shlinkio/shlink.git
synced 2025-02-25 18:45:27 -06:00
Merge pull request #516 from acelaya-forks/feature/qr-code-with-domain
Feature/qr code with domain
This commit is contained in:
commit
43cb91bf52
1
.github/FUNDING.yml
vendored
1
.github/FUNDING.yml
vendored
@ -1 +1,2 @@
|
|||||||
|
github: ['acelaya']
|
||||||
custom: ['https://acel.me/donate']
|
custom: ['https://acel.me/donate']
|
||||||
|
@ -30,6 +30,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com), and this
|
|||||||
|
|
||||||
* [#507](https://github.com/shlinkio/shlink/issues/507) Fixed error with too long original URLs by increasing size to the maximum value (2048) based on [the standard](https://stackoverflow.com/a/417184).
|
* [#507](https://github.com/shlinkio/shlink/issues/507) Fixed error with too long original URLs by increasing size to the maximum value (2048) based on [the standard](https://stackoverflow.com/a/417184).
|
||||||
* [#502](https://github.com/shlinkio/shlink/issues/502) Fixed error when providing the port as part of the domain on short URLs.
|
* [#502](https://github.com/shlinkio/shlink/issues/502) Fixed error when providing the port as part of the domain on short URLs.
|
||||||
|
* [#509](https://github.com/shlinkio/shlink/issues/509) Fixed error when trying to generate a QR code for a short URL which uses a custom domain.
|
||||||
|
|
||||||
|
|
||||||
## 1.19.0 - 2019-10-05
|
## 1.19.0 - 2019-10-05
|
||||||
|
@ -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,
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -36,11 +36,11 @@ class QrCodeActionTest extends TestCase
|
|||||||
}
|
}
|
||||||
|
|
||||||
/** @test */
|
/** @test */
|
||||||
public function aNotFoundShortCodeWillDelegateIntoNextMiddleware()
|
public function aNotFoundShortCodeWillDelegateIntoNextMiddleware(): void
|
||||||
{
|
{
|
||||||
$shortCode = 'abc123';
|
$shortCode = 'abc123';
|
||||||
$this->urlShortener->shortCodeToUrl($shortCode)->willThrow(EntityDoesNotExistException::class)
|
$this->urlShortener->shortCodeToUrl($shortCode, '')->willThrow(EntityDoesNotExistException::class)
|
||||||
->shouldBeCalledOnce();
|
->shouldBeCalledOnce();
|
||||||
$delegate = $this->prophesize(RequestHandlerInterface::class);
|
$delegate = $this->prophesize(RequestHandlerInterface::class);
|
||||||
$process = $delegate->handle(Argument::any())->willReturn(new Response());
|
$process = $delegate->handle(Argument::any())->willReturn(new Response());
|
||||||
|
|
||||||
@ -50,11 +50,11 @@ class QrCodeActionTest extends TestCase
|
|||||||
}
|
}
|
||||||
|
|
||||||
/** @test */
|
/** @test */
|
||||||
public function anInvalidShortCodeWillReturnNotFoundResponse()
|
public function anInvalidShortCodeWillReturnNotFoundResponse(): void
|
||||||
{
|
{
|
||||||
$shortCode = 'abc123';
|
$shortCode = 'abc123';
|
||||||
$this->urlShortener->shortCodeToUrl($shortCode)->willThrow(InvalidShortCodeException::class)
|
$this->urlShortener->shortCodeToUrl($shortCode, '')->willThrow(InvalidShortCodeException::class)
|
||||||
->shouldBeCalledOnce();
|
->shouldBeCalledOnce();
|
||||||
$delegate = $this->prophesize(RequestHandlerInterface::class);
|
$delegate = $this->prophesize(RequestHandlerInterface::class);
|
||||||
$process = $delegate->handle(Argument::any())->willReturn(new Response());
|
$process = $delegate->handle(Argument::any())->willReturn(new Response());
|
||||||
|
|
||||||
@ -64,11 +64,11 @@ class QrCodeActionTest extends TestCase
|
|||||||
}
|
}
|
||||||
|
|
||||||
/** @test */
|
/** @test */
|
||||||
public function aCorrectRequestReturnsTheQrCodeResponse()
|
public function aCorrectRequestReturnsTheQrCodeResponse(): void
|
||||||
{
|
{
|
||||||
$shortCode = 'abc123';
|
$shortCode = 'abc123';
|
||||||
$this->urlShortener->shortCodeToUrl($shortCode)->willReturn(new ShortUrl(''))
|
$this->urlShortener->shortCodeToUrl($shortCode, '')->willReturn(new ShortUrl(''))
|
||||||
->shouldBeCalledOnce();
|
->shouldBeCalledOnce();
|
||||||
$delegate = $this->prophesize(RequestHandlerInterface::class);
|
$delegate = $this->prophesize(RequestHandlerInterface::class);
|
||||||
|
|
||||||
$resp = $this->action->process(
|
$resp = $this->action->process(
|
||||||
|
Loading…
Reference in New Issue
Block a user