X-Git-Url: http://www.aleph1.co.uk/gitweb/?a=blobdiff_plain;ds=sidebyside;f=web%2Fcore%2Flib%2FDrupal%2FCore%2FRouting%2FUrlGenerator.php;fp=web%2Fcore%2Flib%2FDrupal%2FCore%2FRouting%2FUrlGenerator.php;h=853a5f7b4e1babda77e423a4777e49b433b12f2d;hb=0bf8d09d2542548982e81a441b1f16e75873a04f;hp=3b5c8d256b1037266fcd1c0d20b4855c545f0ee3;hpb=74df008bdbb3a11eeea356744f39b802369bda3c;p=yaffs-website diff --git a/web/core/lib/Drupal/Core/Routing/UrlGenerator.php b/web/core/lib/Drupal/Core/Routing/UrlGenerator.php index 3b5c8d256..853a5f7b4 100644 --- a/web/core/lib/Drupal/Core/Routing/UrlGenerator.php +++ b/web/core/lib/Drupal/Core/Routing/UrlGenerator.php @@ -297,6 +297,11 @@ class UrlGenerator implements UrlGeneratorInterface { if ($options['path_processing']) { $path = $this->processPath($path, $options, $generated_url); } + // Ensure the resulting path has at most one leading slash, to prevent it + // becoming an external URL without a protocol like //example.com. + if (strpos($path, '//') === 0) { + $path = '/' . ltrim($path, '/'); + } // The contexts base URL is already encoded // (see Symfony\Component\HttpFoundation\Request). $path = str_replace($this->decodedChars[0], $this->decodedChars[1], rawurlencode($path));