Merge pull request #617 from acelaya-forks/feature/fix-urls-with-hash

Feature/fix urls with hash
This commit is contained in:
Alejandro Celaya 2020-01-12 10:38:25 +01:00 committed by GitHub
commit f5a30c4c2d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 12 additions and 10 deletions

View file

@ -4,7 +4,7 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com), and this project adheres to [Semantic Versioning](https://semver.org).
## [Unreleased]
## 2.0.2 - 2020-01-12
#### Added
@ -25,6 +25,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com), and this
#### Fixed
* [#614](https://github.com/shlinkio/shlink/issues/614) Fixed `OPTIONS` requests including the `Origin` header not always returning an empty body with status 2xx.
* [#615](https://github.com/shlinkio/shlink/issues/615) Fixed query args with no value being lost from the long URL when users are redirected.
## 2.0.1 - 2020-01-10

View file

@ -1,4 +1,5 @@
<?php
declare(strict_types=1);
use Laminas\ConfigAggregator\ConfigAggregator;

View file

@ -1,9 +1,13 @@
<?php
declare(strict_types=1);
use Mezzio\Router\FastRouteRouter;
return [
'router' => [
// 'base_path' => '',
'fastroute' => [
FastRouteRouter::CONFIG_CACHE_ENABLED => false,
],

View file

@ -1,8 +1,9 @@
<?php
declare(strict_types=1);
use Mezzio\Swoole\HotCodeReload\FileWatcher\InotifyFileWatcher;
use Laminas\ServiceManager\Factory\InvokableFactory;
use Mezzio\Swoole\HotCodeReload\FileWatcher\InotifyFileWatcher;
return [

View file

@ -20,8 +20,8 @@ use Shlinkio\Shlink\Core\Service\VisitsTrackerInterface;
use function array_key_exists;
use function array_merge;
use function GuzzleHttp\Psr7\build_query;
use function GuzzleHttp\Psr7\parse_query;
use function http_build_query;
abstract class AbstractTrackingAction implements MiddlewareInterface
{
@ -42,12 +42,6 @@ abstract class AbstractTrackingAction implements MiddlewareInterface
$this->logger = $logger ?: new NullLogger();
}
/**
* Process an incoming server request and return a response, optionally delegating
* to the next middleware component to create the response.
*
*
*/
public function process(ServerRequestInterface $request, RequestHandlerInterface $handler): ResponseInterface
{
$shortCode = $request->getAttribute('shortCode', '');
@ -79,7 +73,7 @@ abstract class AbstractTrackingAction implements MiddlewareInterface
}
$mergedQuery = array_merge($hardcodedQuery, $currentQuery);
return (string) $uri->withQuery(http_build_query($mergedQuery));
return (string) $uri->withQuery(build_query($mergedQuery));
}
abstract protected function createSuccessResp(string $longUrl): ResponseInterface;

View file

@ -64,6 +64,7 @@ class RedirectActionTest extends TestCase
{
yield ['http://domain.com/foo/bar?some=thing', []];
yield ['http://domain.com/foo/bar?some=thing', ['foobar' => 'notrack']];
yield ['http://domain.com/foo/bar?some=thing&else', ['else' => null]];
yield ['http://domain.com/foo/bar?some=thing&foo=bar', ['foo' => 'bar']];
yield ['http://domain.com/foo/bar?some=overwritten&foo=bar', ['foo' => 'bar', 'some' => 'overwritten']];
yield ['http://domain.com/foo/bar?some=overwritten', ['foobar' => 'notrack', 'some' => 'overwritten']];