[BUGFIX] Catch Exceptions in RTE with invalid links 55/58755/2
authorBenni Mack <benni@typo3.org>
Sat, 27 Oct 2018 21:35:40 +0000 (23:35 +0200)
committerAnja Leichsenring <aleichsenring@ab-softlab.de>
Sun, 28 Oct 2018 11:45:36 +0000 (12:45 +0100)
Only one area is covered with catching invalid links when setting
an ugly external URL without proper scheme.

The other area is caught now too.

Resolves: #84009
Releases: master, 8.7
Change-Id: Ief7549009b114803daacf39e36528523718a0d36
Reviewed-on: https://review.typo3.org/58755
Tested-by: TYPO3com <no-reply@typo3.com>
Reviewed-by: Anja Leichsenring <aleichsenring@ab-softlab.de>
Tested-by: Anja Leichsenring <aleichsenring@ab-softlab.de>
typo3/sysext/core/Classes/Html/RteHtmlParser.php

index 9e02239..1efa585 100644 (file)
@@ -574,7 +574,12 @@ class RteHtmlParser extends HtmlParser
                     }
                 } else {
                     // Otherwise store the link as <a> tag as default by TYPO3, with the new link service syntax
-                    $tagAttributes['href'] = $linkService->asString($linkInformation);
+                    try {
+                        $tagAttributes['href'] = $linkService->asString($linkInformation);
+                    } catch (UnknownLinkHandlerException $e) {
+                        $tagAttributes['href'] = $linkInformation['href'] ?? $tagAttributes['href'];
+                    }
+
                     $blockSplit[$k] = '<a ' . GeneralUtility::implodeAttributes($tagAttributes, true) . '>'
                         . $this->TS_links_db($this->removeFirstAndLastTag($blockSplit[$k])) . '</a>';
                 }