[BUGFIX] Ensure links with ampersands are HSC-decoded 81/53281/2
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:57:14 +0000 (13:57 +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/53281
Tested-by: TYPO3com <no-reply@typo3.com>
Reviewed-by: Christian Kuhn <lolli@schwarzbu.ch>
Tested-by: Christian Kuhn <lolli@schwarzbu.ch>
typo3/sysext/frontend/Classes/Typolink/ExternalUrlLinkBuilder.php

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)
         ];