beechit / fal_securedownload

An extension for TYPO3 CMS which adds secure downloads to FAL
36 stars 62 forks source link

Uncaught TYPO3 Exception "#1314516810: Folder "/" does not exist." in BE with long file names #137

Open sternenvogel opened 4 years ago

sternenvogel commented 4 years ago

I got an uncaught TYPO3 Exception "#1314516810: Folder "/" does not exist." with long file names. System: TYPO3 8.7.24, Extension Versions 2.2.0 / 2.1.3 / 1.2.3 / 1.2.2 (probably all)

Steps to reproduce:

  1. Add a folder in fileadmin longer than ca 30 characters
  2. Add a File Storage record in Backend for this folder
  3. Set some restrictions for this folder
  4. Upload a file into this new folder
  5. Click on Module "Filelist" again

Effects:

Expected behavior:

Workaround:

Details:

Uncaught TYPO3 Exception
#1314516810: Folder "/" does not exist. (More information)

TYPO3\CMS\Core\Resource\Exception\FolderDoesNotExistException thrown in file
/var/www/webroot/webcms/vendor/typo3/cms/typo3/sysext/core/Classes/Resource/Driver/LocalDriver.php in line 273.

22 TYPO3\CMS\Core\Resource\Driver\LocalDriver::getFolderInfoByIdentifier("/")

/var/www/webroot/webcms/vendor/typo3/cms/typo3/sysext/core/Classes/Resource/ResourceStorage.php:
02388:     public function getFolder($identifier, $returnInaccessibleFolderObject = false)
02389:     {
02390:         $data = $this->driver->getFolderInfoByIdentifier($identifier);
02391:         $folder = $this->getResourceFactoryInstance()->createFolderObject($this, $data['identifier'], $data['name']);
02392: 

21 TYPO3\CMS\Core\Resource\ResourceStorage::getFolder("/")

/var/www/webroot/webcms/vendor/typo3/cms/typo3/sysext/core/Classes/Resource/Folder.php:
00518:     public function getParentFolder()
00519:     {
00520:         return $this->getStorage()->getFolder($this->getStorage()->getFolderIdentifierFromFileIdentifier($this->getIdentifier()));
00521:     }
00522: 

20 TYPO3\CMS\Core\Resource\Folder::getParentFolder()

/var/www/webroot/webcms/web/typo3conf/ext/fal_securedownload/Classes/Security/CheckPermissions.php:
00191:     {
00192:         $rootLine = array($folder);
00193:         $parentFolder = $folder->getParentFolder();
00194:         $count = 0;
00195:         while ($parentFolder->getIdentifier() !== $folder->getIdentifier()) {

19 BeechIt\FalSecuredownload\Security\CheckPermissions::getFolderRootLine(TYPO3\CMS\Core\Resource\Folder)

/var/www/webroot/webcms/web/typo3conf/ext/fal_securedownload/Classes/Security/CheckPermissions.php:
00115: 
00116:             // loop trough the root line of an folder and check the permissions of every folder
00117:             foreach ($this->getFolderRootLine($folder) as $rootlinefolder) {
00118:                 // fetch folder permissions record
00119:                 $folderRecord = $this->utilityService->getFolderRecord($rootlinefolder);

18 BeechIt\FalSecuredownload\Security\CheckPermissions::checkFolderRootLineAccess(TYPO3\CMS\Core\Resource\Folder, boolean)

/var/www/webroot/webcms/web/typo3conf/ext/fal_securedownload/Classes/Aspects/IconFactoryAspect.php:
00068: 
00069:                 // check if there are access restrictions in the root line of this folder
00070:             } elseif (!$checkPermissionsService->checkFolderRootLineAccess($folder, false)) {
00071:                 $overlayIdentifier = 'overlay-inherited-permissions';
00072:             }

17 BeechIt\FalSecuredownload\Aspects\IconFactoryAspect::buildIconForResource(TYPO3\CMS\Core\Resource\Folder, "small", array, "apps-filetree-folder-locked", NULL, "TYPO3\CMS\Core\Imaging\IconFactory::buildIconForResourceSignal")
16 call_user_func_array(array, array)

/var/www/webroot/webcms/vendor/typo3/cms/typo3/sysext/extbase/Classes/SignalSlot/Dispatcher.php:
00137:             }
00138: 
00139:             $slotReturn = call_user_func_array([$object, $slotInformation['method']], $preparedSlotArguments);
00140: 
00141:             if ($slotReturn) {

15 TYPO3\CMS\Extbase\SignalSlot\Dispatcher::dispatch("TYPO3\CMS\Core\Imaging\IconFactory", "buildIconForResourceSignal", array)

/var/www/webroot/webcms/vendor/typo3/cms/typo3/sysext/core/Classes/Imaging/IconFactory.php:
00505:             self::class,
00506:             'buildIconForResourceSignal',
00507:             [$resource, $size, $options, $iconIdentifier, $overlayIdentifier]
00508:         );
00509:         $iconIdentifier = $result[3];

14 TYPO3\CMS\Core\Imaging\IconFactory::emitBuildIconForResourceSignal(TYPO3\CMS\Core\Resource\Folder, "small", array, "apps-filetree-folder-locked", NULL)

/var/www/webroot/webcms/vendor/typo3/cms/typo3/sysext/core/Classes/Imaging/IconFactory.php:
00454:         unset($options['folder-open']);
00455:         list($iconIdentifier, $overlayIdentifier) =
00456:             $this->emitBuildIconForResourceSignal($resource, $size, $options, $iconIdentifier, $overlayIdentifier);
00457:         return $this->getIcon($iconIdentifier, $size, $overlayIdentifier);
00458:     }

13 TYPO3\CMS\Core\Imaging\IconFactory::getIconForResource(TYPO3\CMS\Core\Resource\Folder, "small", NULL, array)

/var/www/webroot/webcms/vendor/typo3/cms/typo3/sysext/backend/Classes/Tree/View/FolderTreeView.php:
00333:             }
00334:             // Preparing rootRec for the mount
00335:             $icon = $this->iconFactory->getIconForResource($rootLevelFolder, Icon::SIZE_SMALL, null, ['mount-root' => true]);
00336:             $firstHtml .= $this->wrapIcon($icon, $rootLevelFolder);
00337:             $row = [

12 TYPO3\CMS\Backend\Tree\View\FolderTreeView::getBrowseableTreeForStorage(TYPO3\CMS\Core\Resource\ResourceStorage)

/var/www/webroot/webcms/vendor/typo3/cms/typo3/sysext/backend/Classes/Tree/View/FolderTreeView.php:
00275:         // Traverse mounts:
00276:         foreach ($this->storages as $storageObject) {
00277:             $this->getBrowseableTreeForStorage($storageObject);
00278:             // Add tree:
00279:             $treeItems = array_merge($treeItems, $this->tree);

11 TYPO3\CMS\Backend\Tree\View\FolderTreeView::getBrowsableTree()

/var/www/webroot/webcms/vendor/typo3/cms/typo3/sysext/backend/Classes/Controller/FileSystemNavigationFrameController.php:
00187:     {
00188:         // Produce browse-tree:
00189:         $tree = $this->foldertree->getBrowsableTree();
00190:         // Outputting page tree:
00191:         $this->moduleTemplate->setContent($tree);

10 TYPO3\CMS\Backend\Controller\FileSystemNavigationFrameController::main()

/var/www/webroot/webcms/vendor/typo3/cms/typo3/sysext/backend/Classes/Controller/FileSystemNavigationFrameController.php:
00083:     {
00084:         $this->initPage();
00085:         $this->main();
00086: 
00087:         $response->getBody()->write($this->content);

9 TYPO3\CMS\Backend\Controller\FileSystemNavigationFrameController::mainAction(TYPO3\CMS\Core\Http\ServerRequest, TYPO3\CMS\Core\Http\Response)
8 call_user_func_array(array, array)

/var/www/webroot/webcms/vendor/typo3/cms/typo3/sysext/backend/Classes/Http/RouteDispatcher.php:
00052:         $targetIdentifier = $route->getOption('target');
00053:         $target = $this->getCallableFromTarget($targetIdentifier);
00054:         return call_user_func_array($target, [$request, $response]);
00055:     }
00056: 

7 TYPO3\CMS\Backend\Http\RouteDispatcher::dispatch(TYPO3\CMS\Core\Http\ServerRequest, TYPO3\CMS\Core\Http\Response)

/var/www/webroot/webcms/vendor/typo3/cms/typo3/sysext/backend/Classes/Http/RequestHandler.php:
00137:         /** @var RouteDispatcher $dispatcher */
00138:         $dispatcher = GeneralUtility::makeInstance(RouteDispatcher::class);
00139:         return $dispatcher->dispatch($request, $response);
00140:     }
00141: }

6 TYPO3\CMS\Backend\Http\RequestHandler::dispatch(TYPO3\CMS\Core\Http\ServerRequest)

/var/www/webroot/webcms/vendor/typo3/cms/typo3/sysext/backend/Classes/Http/RequestHandler.php:
00070:         // Check if the router has the available route and dispatch.
00071:         try {
00072:             return $this->dispatch($request);
00073:         } catch (InvalidRequestTokenException $e) {
00074:             // When token was invalid redirect to login

5 TYPO3\CMS\Backend\Http\RequestHandler::handleRequest(TYPO3\CMS\Core\Http\ServerRequest)

/var/www/webroot/webcms/vendor/typo3/cms/typo3/sysext/core/Classes/Core/Bootstrap.php:
00317: 
00318:         // Execute the command which returns a Response object or NULL
00319:         $this->response = $requestHandler->handleRequest($request);
00320:         return $this;
00321:     }

4 TYPO3\CMS\Core\Core\Bootstrap::handleRequest(TYPO3\CMS\Core\Http\ServerRequest)

/var/www/webroot/webcms/vendor/typo3/cms/typo3/sysext/backend/Classes/Http/Application.php:
00090:         }
00091: 
00092:         $this->bootstrap->handleRequest($this->request);
00093: 
00094:         if ($execute !== null) {

3 TYPO3\CMS\Backend\Http\Application::run()

/var/www/webroot/webcms/vendor/typo3/cms/typo3/sysext/backend/Resources/Private/Php/backend.php:
00022:     $classLoader = require __DIR__ . '/../../../../../../vendor/autoload.php';
00023: 
00024:     (new \TYPO3\CMS\Backend\Http\Application($classLoader))->run();
00025: });

2 {closure}()

/var/www/webroot/webcms/vendor/typo3/cms/typo3/sysext/backend/Resources/Private/Php/backend.php:
00023: 
00024:     (new \TYPO3\CMS\Backend\Http\Application($classLoader))->run();
00025: });

1 require("/var/www/webroot/webcms/vendor/typo3/cms/typo3/sysext/backend/Resources/Private/Php/backend.php")

/var/www/webroot/webcms/vendor/typo3/cms/typo3/index.php:
00001: <?php
00002: 
00003: require __DIR__ . '/sysext/backend/Resources/Private/Php/backend.php';
aWuttig commented 4 years ago

maybe some root folder for the file storage is really missing. for me this was the problem. after creating the folders everything works fine.

wowaTYPO3 commented 6 months ago

Since yesterday, a customer project with TYPO3 9.5.47 ELTS and fal_securedownload 2.2.0 is suddenly experiencing exactly this problem. The extension has been in use in this project for about 1 year and has worked without any problems so far. (I know these are old versions, the customer had previously opted for ELTS. Now he is slowly realizing the necessity of an upgrade ;) ) However, the suggested solutions mentioned above have not helped, I have tried everything and am now at a bit of a loss. Especially because the problem has really occurred "from now on".

Would be grateful for any tips and hints.

It would of course also be interesting to know whether the problem could be solved by upgrading TYPO3 and the extension.