Skip to content
Snippets Groups Projects
Commit 8704d23f authored by catch's avatar catch
Browse files

Issue #3027763 by quietone, LiamPower, pratik_kamble: UnroutedUrlAssembler...

Issue #3027763 by quietone, LiamPower, pratik_kamble: UnroutedUrlAssembler removes query params array item key in buildExternalUrl()

(cherry picked from commit 0c162500850c1e2da56b63d5e6e54e1aba172871)
parent c7a563c6
No related branches found
No related tags found
9 merge requests!1445Issue #2920039: Views' User Name exposed group filter validation,!1298Issue #3240993: Let layout builder render inline block translations,!774Issue #3174569: Example node template file name is incorrect,!497Issue #2463967: Use .user.ini file for PHP settings,!433Resolve #3163663 "Too many open files",!233Resolve #2693787 "Taxonomy term name",!133Resolve #2666286 "Clean up menuui",!112Resolve #3187004 "Drupaldatetime serialization issue",!53Resolve #3181870: Correct typo "the the" in "core/classList" deprecation message.
...@@ -77,7 +77,7 @@ protected function buildExternalUrl($uri, array $options = [], $collect_bubbleab ...@@ -77,7 +77,7 @@ protected function buildExternalUrl($uri, array $options = [], $collect_bubbleab
$parsed += ['query' => []]; $parsed += ['query' => []];
$options += ['query' => []]; $options += ['query' => []];
$options['query'] = NestedArray::mergeDeep($parsed['query'], $options['query']); $options['query'] = NestedArray::mergeDeepArray([$parsed['query'], $options['query']], TRUE);
if ($parsed['fragment'] && !$options['fragment']) { if ($parsed['fragment'] && !$options['fragment']) {
$options['fragment'] = '#' . $parsed['fragment']; $options['fragment'] = '#' . $parsed['fragment'];
......
...@@ -313,6 +313,11 @@ public function testExternalUrls() { ...@@ -313,6 +313,11 @@ public function testExternalUrls() {
$result = Url::fromUri($url)->toString(); $result = Url::fromUri($url)->toString();
$this->assertEqual($url, $result); $this->assertEqual($url, $result);
// Verify external URL can contain a query string with an integer key.
$url = $test_url . '?120=1';
$result = Url::fromUri($url)->toString();
$this->assertEqual($url, $result);
// Verify external URL can be extended with a query string. // Verify external URL can be extended with a query string.
$url = $test_url; $url = $test_url;
$query = ['awesome' => 'drupal']; $query = ['awesome' => 'drupal'];
......
...@@ -99,6 +99,7 @@ public function providerTestAssembleWithExternalUrl() { ...@@ -99,6 +99,7 @@ public function providerTestAssembleWithExternalUrl() {
'override-query' => ['https://example.com/test?foo=1#bar', ['query' => ['foo' => 2]], 'https://example.com/test?foo=2#bar'], 'override-query' => ['https://example.com/test?foo=1#bar', ['query' => ['foo' => 2]], 'https://example.com/test?foo=2#bar'],
'override-query-merge' => ['https://example.com/test?foo=1#bar', ['query' => ['bar' => 2]], 'https://example.com/test?foo=1&bar=2#bar'], 'override-query-merge' => ['https://example.com/test?foo=1#bar', ['query' => ['bar' => 2]], 'https://example.com/test?foo=1&bar=2#bar'],
'override-deep-query-merge' => ['https://example.com/test?foo=1#bar', ['query' => ['bar' => ['baz' => 'foo']]], 'https://example.com/test?foo=1&bar%5Bbaz%5D=foo#bar'], 'override-deep-query-merge' => ['https://example.com/test?foo=1#bar', ['query' => ['bar' => ['baz' => 'foo']]], 'https://example.com/test?foo=1&bar%5Bbaz%5D=foo#bar'],
'override-deep-query-merge-int-ket' => ['https://example.com/test?120=1', ['query' => ['bar' => ['baz' => 'foo']]], 'https://example.com/test?120=1&bar%5Bbaz%5D=foo'],
'override-fragment' => ['https://example.com/test?foo=1#bar', ['fragment' => 'baz'], 'https://example.com/test?foo=1#baz'], 'override-fragment' => ['https://example.com/test?foo=1#bar', ['fragment' => 'baz'], 'https://example.com/test?foo=1#baz'],
['//www.drupal.org', [], '//www.drupal.org'], ['//www.drupal.org', [], '//www.drupal.org'],
]; ];
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment