[BUGFIX] Ignore empty inputs when creating new folders 51/27651/2
authorFrans Saris <franssaris@gmail.com>
Mon, 17 Feb 2014 09:07:00 +0000 (10:07 +0100)
committerAnja Leichsenring <aleichsenring@ab-softlab.de>
Mon, 17 Feb 2014 20:53:27 +0000 (21:53 +0100)
When you try to create one of multiple folders in filemodule
and leave one of the new name input fields empty this results
in a non catched exeption.

This change filters out the empty input fields and gives a
error message when no name is given.

Resolves: #56034
Releases: 6.2
Change-Id: I1d341d1b7951dc8e8fe64190168f8b71c6f75676
Reviewed-on: https://review.typo3.org/27651
Reviewed-by: Wouter Wolters
Tested-by: Wouter Wolters
Reviewed-by: Anja Leichsenring
Tested-by: Anja Leichsenring
typo3/sysext/core/Classes/Utility/File/ExtendedFileUtility.php

index 90492fe..26f22b3 100644 (file)
@@ -222,6 +222,19 @@ class ExtendedFileUtility extends \TYPO3\CMS\Core\Utility\File\BasicFileUtility
                                        $this->writelog(1, 1, 108, 'No file was uploaded!', '');
                                }
                        }
+
+                       // Check if there were new folder names expected, but non given
+                       if ($this->fileCmdMap['newfolder']) {
+                               foreach ($this->fileCmdMap['newfolder'] as $key => $cmdArr) {
+                                       if (empty($cmdArr['data'])) {
+                                               unset($this->fileCmdMap['newfolder'][$key]);
+                                       }
+                               }
+                               if (count($this->fileCmdMap['newfolder']) === 0) {
+                                       $this->writeLog(6, 1, 108, 'No name for new folder given!', '');
+                               }
+                       }
+
                        // Traverse each set of actions
                        foreach ($this->fileCmdMap as $action => $actionData) {
                                // Traverse all action data. More than one file might be affected at the same time.