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
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -77,7 +77,7 @@ protected function buildExternalUrl($uri, array $options = [], $collect_bubbleab
    $parsed += ['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']) {
      $options['fragment'] = '#' . $parsed['fragment'];
+5 −0
Original line number Diff line number Diff line
@@ -313,6 +313,11 @@ public function testExternalUrls() {
    $result = Url::fromUri($url)->toString();
    $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.
    $url = $test_url;
    $query = ['awesome' => 'drupal'];
+1 −0
Original line number Diff line number Diff line
@@ -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-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-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'],
      ['//www.drupal.org', [], '//www.drupal.org'],
    ];