[BUGFIX] Ensure proper conflictMode on t3d upload 84/49984/3
authorNicole Cordes <typo3@cordes.co>
Tue, 20 Sep 2016 16:31:24 +0000 (18:31 +0200)
committerGeorg Ringer <georg.ringer@gmail.com>
Wed, 21 Sep 2016 11:16:35 +0000 (13:16 +0200)
The overwriteExistingFiles argument in ImportExportController can't be
cast to \TYPO3\CMS\Core\Resource\DuplicationBehavior due to an empty
value. This patch ensures a correct conflict mode which can be cast.

Resolves: #78017
Related: #77136
Releases: master
Change-Id: Ib55191bc2f6368d2322270315083f80ee13fe45d
Reviewed-on: https://review.typo3.org/49984
Reviewed-by: Wouter Wolters <typo3@wouterwolters.nl>
Tested-by: TYPO3com <no-reply@typo3.com>
Reviewed-by: Georg Ringer <georg.ringer@gmail.com>
Tested-by: Georg Ringer <georg.ringer@gmail.com>
typo3/sysext/impexp/Classes/Controller/ImportExportController.php

index a528413..4de045c 100644 (file)
@@ -954,7 +954,8 @@ class ImportExportController extends BaseScriptClass
         $this->fileProcessor = GeneralUtility::makeInstance(ExtendedFileUtility::class);
         $this->fileProcessor->init([], $GLOBALS['TYPO3_CONF_VARS']['BE']['fileExtensions']);
         $this->fileProcessor->setActionPermissions();
-        $this->fileProcessor->setExistingFilesConflictMode(DuplicationBehavior::cast(GeneralUtility::_GP('overwriteExistingFiles')));
+        $conflictMode = empty(GeneralUtility::_GP('overwriteExistingFiles')) ? DuplicationBehavior::__default : DuplicationBehavior::REPLACE;
+        $this->fileProcessor->setExistingFilesConflictMode(DuplicationBehavior::cast($conflictMode));
         // Checking referer / executing:
         $refInfo = parse_url(GeneralUtility::getIndpEnv('HTTP_REFERER'));
         $httpHost = GeneralUtility::getIndpEnv('TYPO3_HOST_ONLY');