[BUGFIX] LinkService must handle old ?id=xyz links 67/52567/5
authorMarkus Klein <markus.klein@typo3.org>
Mon, 24 Apr 2017 12:42:36 +0000 (14:42 +0200)
committerBenni Mack <benni@typo3.org>
Wed, 26 Apr 2017 18:42:53 +0000 (20:42 +0200)
Resolves: #80986
Releases: master, 8.7
Change-Id: Ibad311e95abca06f2e20656b3b34000a4dfdb8a0
Reviewed-on: https://review.typo3.org/52567
Tested-by: TYPO3com <no-reply@typo3.com>
Reviewed-by: Johannes Kasberger <johannes.kasberger@reelworx.at>
Tested-by: Johannes Kasberger <johannes.kasberger@reelworx.at>
Reviewed-by: Christer V <cvi@systime.dk>
Tested-by: Christer V <cvi@systime.dk>
Reviewed-by: Benni Mack <benni@typo3.org>
Tested-by: Benni Mack <benni@typo3.org>
typo3/sysext/core/Classes/LinkHandling/LegacyLinkNotationConverter.php

index 48ca6e4..b8533da 100644 (file)
@@ -82,8 +82,15 @@ class LegacyLinkNotationConverter
             $fileChar = (int)strpos($linkParameter, '/');
             $urlChar = (int)strpos($linkParameter, '.');
 
+            $isIdOrAlias = MathUtility::canBeInterpretedAsInteger($linkParameter);
+            $matches = [];
+            // capture old RTE links relative to TYPO3_mainDir
+            if (preg_match('#../\\?id=([^&]+)#', $linkParameter, $matches)) {
+                $linkParameter = $matches[1];
+                $isIdOrAlias = true;
+            }
             $containsSlash = false;
-            if (!MathUtility::canBeInterpretedAsInteger($linkParameter)) {
+            if (!$isIdOrAlias) {
                 // Detects if a file is found in site-root and if so it will be treated like a normal file.
                 list($rootFileDat) = explode('?', rawurldecode($linkParameter));
                 $containsSlash = strpos($rootFileDat, '/') !== false;
@@ -106,7 +113,7 @@ class LegacyLinkNotationConverter
             }
 
             // url (external): If doubleSlash or if a '.' comes before a '/'.
-            if ($isLocalFile !== 1 && $urlChar && (!$containsSlash || $urlChar < $fileChar)) {
+            if (!$isIdOrAlias && $isLocalFile !== 1 && $urlChar && (!$containsSlash || $urlChar < $fileChar)) {
                 $result['type'] = LinkService::TYPE_URL;
                 if (!$scheme) {
                     $result['url'] = 'http://' . $linkParameter;