Fixed merge conflicts

This commit is contained in:
Alejandro Celaya 2021-08-15 19:32:27 +02:00
commit cd06cea153
3 changed files with 23 additions and 3 deletions

View file

@ -23,6 +23,23 @@ The format is based on [Keep a Changelog](https://keepachangelog.com), and this
* *Nothing* * *Nothing*
## [2.8.1] - 2021-08-15
### Added
* *Nothing*
### Changed
* *Nothing*
### Deprecated
* *Nothing*
### Removed
* *Nothing*
### Fixed
* [#1155](https://github.com/shlinkio/shlink/issues/1155) Fixed numeric query params in long URLs being replaced by `0`.
## [2.8.0] - 2021-08-04 ## [2.8.0] - 2021-08-04
### Added ### Added
* [#1089](https://github.com/shlinkio/shlink/issues/1089) Added new `ENABLE_PERIODIC_VISIT_LOCATE` env var to docker image which schedules the `visit:locate` command every hour when provided with value `true`. * [#1089](https://github.com/shlinkio/shlink/issues/1089) Added new `ENABLE_PERIODIC_VISIT_LOCATE` env var to docker image which schedules the `visit:locate` command every hour when provided with value `true`.

View file

@ -5,11 +5,11 @@ declare(strict_types=1);
namespace Shlinkio\Shlink\Core\ShortUrl\Helper; namespace Shlinkio\Shlink\Core\ShortUrl\Helper;
use GuzzleHttp\Psr7\Query; use GuzzleHttp\Psr7\Query;
use Laminas\Stdlib\ArrayUtils;
use League\Uri\Uri; use League\Uri\Uri;
use Shlinkio\Shlink\Core\Entity\ShortUrl; use Shlinkio\Shlink\Core\Entity\ShortUrl;
use Shlinkio\Shlink\Core\Options\TrackingOptions; use Shlinkio\Shlink\Core\Options\TrackingOptions;
use function array_merge;
use function sprintf; use function sprintf;
class ShortUrlRedirectionBuilder implements ShortUrlRedirectionBuilderInterface class ShortUrlRedirectionBuilder implements ShortUrlRedirectionBuilderInterface
@ -37,7 +37,8 @@ class ShortUrlRedirectionBuilder implements ShortUrlRedirectionBuilderInterface
unset($currentQuery[$disableTrackParam]); unset($currentQuery[$disableTrackParam]);
} }
$mergedQuery = array_merge($hardcodedQuery, $currentQuery); // We want to merge preserving numeric keys, as some params might be numbers
$mergedQuery = ArrayUtils::merge($hardcodedQuery, $currentQuery, true);
return empty($mergedQuery) ? null : Query::build($mergedQuery); return empty($mergedQuery) ? null : Query::build($mergedQuery);
} }

View file

@ -37,6 +37,8 @@ class ShortUrlRedirectionBuilderTest extends TestCase
yield ['https://domain.com/foo/bar?some=thing', [], null]; yield ['https://domain.com/foo/bar?some=thing', [], null];
yield ['https://domain.com/foo/bar?some=thing&else', ['else' => null], null]; yield ['https://domain.com/foo/bar?some=thing&else', ['else' => null], null];
yield ['https://domain.com/foo/bar?some=thing&foo=bar', ['foo' => 'bar'], null]; yield ['https://domain.com/foo/bar?some=thing&foo=bar', ['foo' => 'bar'], null];
yield ['https://domain.com/foo/bar?some=thing&123=foo', ['123' => 'foo'], null];
yield ['https://domain.com/foo/bar?some=thing&456=foo', [456 => 'foo'], null];
yield ['https://domain.com/foo/bar?some=overwritten&foo=bar', ['foo' => 'bar', 'some' => 'overwritten'], null]; yield ['https://domain.com/foo/bar?some=overwritten&foo=bar', ['foo' => 'bar', 'some' => 'overwritten'], null];
yield ['https://domain.com/foo/bar?some=overwritten', ['foobar' => 'notrack', 'some' => 'overwritten'], null]; yield ['https://domain.com/foo/bar?some=overwritten', ['foobar' => 'notrack', 'some' => 'overwritten'], null];
yield ['https://domain.com/foo/bar/something/else-baz?some=thing', [], '/something/else-baz']; yield ['https://domain.com/foo/bar/something/else-baz?some=thing', [], '/something/else-baz'];