Issue Bug Closed

#105152503 when editor has no access to the default storage #2

Wolfgang Klinger 09/27/24, 11:22 updated 12/02/25, 14:32

Description

The bug (tried) to fix here: https://forge.typo3.org/issues/103897
is still an open bug here: typo3/cms-filelist/Classes/LinkHandler/AbstractResourceLinkHandler.php:198
where the same condition is used.

        if (!$this->selectedFolder) {
            $this->selectedFolder = $this->resourceFactory->getDefaultStorage()?->getRootLevelFolder() ?? null;
        }

How to reproduce:
- Create a text element
- Add some text
- Link the text
- Select “File” in the opening dialog
- Booomm

Solution is the same as in the already published fix:

        if (!$this->selectedFolder) {
            $allStorages = $this->getBackendUser()->getFileStorages();
            $defaultStorage = $this->resourceFactory->getDefaultStorage();
            if ($defaultStorage && array_key_exists($defaultStorage->getUid(), $allStorages)) {
                $this->selectedFolder = $defaultStorage->getRootLevelFolder();
            } else {
                $this->selectedFolder = reset($allStorages)->getRootLevelFolder();
            }
        }

Reviews 9