[BUGFIX] Make IRRE Filetype check less greedy 42/36742/4
authorMathias Schreiber <mathias.schreiber@wmdb.de>
Sun, 8 Feb 2015 12:39:34 +0000 (13:39 +0100)
committerWouter Wolters <typo3@wouterwolters.nl>
Sun, 8 Feb 2015 15:49:43 +0000 (16:49 +0100)
IREE relations should check for allowed filetypes (which is good) but
due to a minor tunnel vision it always checked for allowed filetypes
even if the relation did not use filetypes at all.

Resolves: #64845
Resolves: #64898
Releases: master
Change-Id: I73c02d7ac2da44de3dd0da4628d7327085aa8990
Reviewed-on: http://review.typo3.org/36742
Reviewed-by: Mathias Schreiber <mathias.schreiber@wmdb.de>
Tested-by: Mathias Schreiber <mathias.schreiber@wmdb.de>
Reviewed-by: Wouter Wolters <typo3@wouterwolters.nl>
Tested-by: Wouter Wolters <typo3@wouterwolters.nl>
typo3/sysext/backend/Classes/Form/Element/InlineElement.php

index 2b6f01b..2b717ab 100644 (file)
@@ -1322,10 +1322,11 @@ class InlineElement {
                        // For a selector of type group/db, prepend the tablename (<tablename>_<uid>):
                        $record[$config['foreign_selector']] = $selConfig['type'] != 'groupdb' ? '' : $selConfig['table'] . '_';
                        $record[$config['foreign_selector']] .= $foreignUid;
-                       $fileRecord = $this->getRecord(0, $selConfig['table'], $foreignUid);
-
-                       if (!$this->checkFileTypeAccessForField($selConfig, $fileRecord)) {
-                               return $this->getErrorMessageForAJAX('File extension ' . $fileRecord['extension'] . ' is not allowed here!');
+                       if ($selConfig['table'] === 'sys_file') {
+                               $fileRecord = $this->getRecord(0, $selConfig['table'], $foreignUid);
+                               if ($fileRecord !== FALSE && !$this->checkFileTypeAccessForField($selConfig, $fileRecord)) {
+                                       return $this->getErrorMessageForAJAX('File extension ' . $fileRecord['extension'] . ' is not allowed here!');
+                               }
                        }
                }
                // The HTML-object-id's prefix of the dynamically created record
@@ -1376,7 +1377,7 @@ class InlineElement {
         * @return bool
         */
        protected function checkFileTypeAccessForField(array $selectorConfiguration, array $fileRecord) {
-               if (isset($selectorConfiguration['PA']['fieldConf']['config']['appearance']['elementBrowserAllowed'])) {
+               if (!empty($selectorConfiguration['PA']['fieldConf']['config']['appearance']['elementBrowserAllowed'])) {
                        $allowedFileExtensions = GeneralUtility::trimExplode(
                                ',',
                                $selectorConfiguration['PA']['fieldConf']['config']['appearance']['elementBrowserAllowed'],