[BUGFIX] Ensure links with ampersands are HSC-decoded 68/53268/4
authorBenni Mack <benni@typo3.org>
Tue, 20 Jun 2017 08:08:51 +0000 (10:08 +0200)
committerChristian Kuhn <lolli@schwarzbu.ch>
Tue, 20 Jun 2017 11:41:54 +0000 (13:41 +0200)
Since the new link structure is in place with TYPO3 v8
all links are properly htmlspecialchar'ed in the database.

This means, that links with an ampersand are now encoded
and need to be decoded on output so ampersands are rendered
as "&" and not as "&amp;" in the frontend.

Resolves: #80985
Resolves: #81625
Releases: master, 8.7
Change-Id: I213f84453a721b97c3238662febe10d0fb5a9bf7
Reviewed-on: https://review.typo3.org/53268
Tested-by: TYPO3com <no-reply@typo3.com>
Reviewed-by: Susanne Moog <susanne.moog@typo3.org>
Tested-by: Susanne Moog <susanne.moog@typo3.org>
Reviewed-by: Thomas Hohn <thomas@hohn.dk>
Reviewed-by: Tobi Kretschmann <tobi@tobishome.de>
Tested-by: Tobi Kretschmann <tobi@tobishome.de>
Reviewed-by: Steffen Frese <steffenf14@gmail.com>
Tested-by: Steffen Frese <steffenf14@gmail.com>
Reviewed-by: Christian Kuhn <lolli@schwarzbu.ch>
Tested-by: Christian Kuhn <lolli@schwarzbu.ch>

index 46a45d8..da20f1d 100644 (file)
@@ -27,7 +27,7 @@ class ExternalUrlLinkBuilder extends AbstractTypolinkBuilder
     public function build(array &$linkDetails, string $linkText, string $target, array $conf): array
         return [
-            $this->processUrl(UrlProcessorInterface::CONTEXT_EXTERNAL, $linkDetails['url'], $conf),
+            $this->processUrl(UrlProcessorInterface::CONTEXT_EXTERNAL, htmlspecialchars_decode($linkDetails['url']), $conf),
             $this->parseFallbackLinkTextIfLinkTextIsEmpty($linkText, $linkDetails['url']),
             $target ?: $this->resolveTargetAttribute($conf, 'extTarget', true, $this->getTypoScriptFrontendController()->extTarget)