[BUGFIX] Allow file:// links in Element Browser 65/37365/2
authorNicole Cordes <typo3@cordes.co>
Fri, 27 Feb 2015 19:20:36 +0000 (20:20 +0100)
committerAnja Leichsenring <aleichsenring@ab-softlab.de>
Sat, 28 Feb 2015 18:52:46 +0000 (19:52 +0100)
Due to FAL checks it's not possible to link to a file:// resource as
external link. This patch checks for correct "file:" prefix for FAL
relations and allows the use of file:// as external link scheme.

Furthermore a Javascript error is resolved which prevents the closing
of the Element Browser in Chrome.

Releases: master, 6.2
Resolves: #65358
Change-Id: I706fd975654bf82a0830d9901f08ae9de7cc49bf
Reviewed-on: http://review.typo3.org/37365
Reviewed-by: Anja Leichsenring <aleichsenring@ab-softlab.de>
Tested-by: Anja Leichsenring <aleichsenring@ab-softlab.de>
typo3/sysext/core/Classes/Html/RteHtmlParser.php
typo3/sysext/recordlist/Classes/Browser/ElementBrowser.php
typo3/sysext/rtehtmlarea/htmlarea/plugins/TYPO3Link/typo3link.js

index 38f4149..cfafceb 100644 (file)
@@ -703,7 +703,7 @@ class RteHtmlParser extends \TYPO3\CMS\Core\Html\HtmlParser {
                                } else {
                                        // Check for FAL link-handler keyword:
                                        list($linkHandlerKeyword, $linkHandlerValue) = explode(':', trim($link_param), 2);
-                                       if ($linkHandlerKeyword === 'file') {
+                                       if ($linkHandlerKeyword === 'file' && !GeneralUtility::isFirstPartOfStr($link_param, 'file://')) {
                                                $href = $siteUrl . '?' . $linkHandlerKeyword . ':' . rawurlencode($linkHandlerValue);
                                        } else {
                                                $fileChar = (int)strpos($link_param, '/');
index 1516183..2d07e98 100644 (file)
@@ -2327,7 +2327,7 @@ class ElementBrowser {
                        if (count($specialParts) == 2) {
                                $info['value'] = '#_SPECIAL' . $specialParts[1];
                                $info['act'] = 'spec';
-                       } elseif (strpos($href, 'file:') !== FALSE) {
+                       } elseif (GeneralUtility::isFirstPartOfStr($href, 'file:') && !GeneralUtility::isFirstPartOfStr($href, 'file://')) {
                                $rel = substr($href, strpos($href, 'file:') + 5);
                                $rel = rawurldecode($rel);
                                // resolve FAL-api "file:UID-of-sys_file-record" and "file:combined-identifier"
index 9450820..6421d48 100644 (file)
@@ -326,7 +326,7 @@ HTMLArea.TYPO3Link = Ext.extend(HTMLArea.Plugin, {
                                        }
                                }
                                if (Ext.isGecko) {
-                                       node.href = decodeURI(node.href);
+                                       node.href = decodeURI(node.getAttributeNode('href').value);
                                }
                                if (cur_target.trim()) node.target = cur_target.trim();
                                        else node.removeAttribute('target');