Commit 38616222 authored by Frans Saris's avatar Frans Saris Committed by Anja Leichsenring
Browse files

[BUGFIX] Check default storage first to find default upload folder

Resolves: #65040
Releases: master, 6.2
Change-Id: I14d6d362db1796c90b03254f6339cb131f152a45
Reviewed-on: http://review.typo3.org/37159


Reviewed-by: default avatarViktor Livakivskyi <invisible.kinder@gmail.com>
Tested-by: default avatarViktor Livakivskyi <invisible.kinder@gmail.com>
Reviewed-by: Wouter Wolters's avatarWouter Wolters <typo3@wouterwolters.nl>
Reviewed-by: default avatarMichael Oehlhof <typo3@oehlhof.de>
Reviewed-by: Anja Leichsenring's avatarAnja Leichsenring <aleichsenring@ab-softlab.de>
Tested-by: Anja Leichsenring's avatarAnja Leichsenring <aleichsenring@ab-softlab.de>
parent bafb0dd4
......@@ -14,6 +14,7 @@ namespace TYPO3\CMS\Core\Authentication;
* The TYPO3 project - inspiring people to share!
*/
use TYPO3\CMS\Core\Resource\ResourceStorage;
use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3\CMS\Backend\Utility\BackendUtility;
......@@ -1833,11 +1834,25 @@ class BackendUserAuthentication extends \TYPO3\CMS\Core\Authentication\AbstractU
$uploadFolder = \TYPO3\CMS\Core\Resource\ResourceFactory::getInstance()->getFolderObjectFromCombinedIdentifier($uploadFolder);
} else {
foreach($this->getFileStorages() as $storage) {
try {
$uploadFolder = $storage->getDefaultFolder();
if ($storage->isDefault()) {
try {
$uploadFolder = $storage->getDefaultFolder();
break;
} catch (\TYPO3\CMS\Core\Resource\Exception $folderAccessException) {
// If the folder is not accessible (no permissions / does not exist) we skip this one.
}
break;
} catch (\TYPO3\CMS\Core\Resource\Exception $folderAccessException) {
// If the folder is not accessible (no permissions / does not exist) try the next one.
}
}
if (!$uploadFolder instanceof \TYPO3\CMS\Core\Resource\Folder) {
/** @var ResourceStorage $storage */
foreach ($this->getFileStorages() as $storage) {
try {
$uploadFolder = $storage->getDefaultFolder();
break;
} catch (\TYPO3\CMS\Core\Resource\Exception $folderAccessException) {
// If the folder is not accessible (no permissions / does not exist) try the next one.
}
}
}
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment