[BUGFIX] Add support for t3:// syntax to FileCollector 50/54250/3
authorJigal van Hemert <jigal.van.hemert@typo3.org>
Sun, 1 Oct 2017 11:08:52 +0000 (13:08 +0200)
committerBenni Mack <benni@typo3.org>
Fri, 6 Oct 2017 15:23:30 +0000 (17:23 +0200)
FileCollector::addFilesFromFolder now supports the t3://folder URN as
identifier for a folder. This allows the FILES cObj and the
FilesProcessor data processing to use that syntax.

Resolves: #82627
Releases: master, 8.7
Change-Id: I31376169f5868c6f7c52cf2b6ca98fe41bb1e111
Reviewed-on: https://review.typo3.org/54250
Reviewed-by: Andreas Fernandez <typo3@scripting-base.de>
Tested-by: Andreas Fernandez <typo3@scripting-base.de>
Tested-by: TYPO3com <no-reply@typo3.com>
Reviewed-by: Frans Saris <franssaris@gmail.com>
Reviewed-by: Wouter Wolters <typo3@wouterwolters.nl>
Reviewed-by: Benni Mack <benni@typo3.org>
Reviewed-by: Joerg Boesche <typo3@joergboesche.de>
Tested-by: Benni Mack <benni@typo3.org>
typo3/sysext/frontend/Classes/Resource/FileCollector.php

index 0e5667a..2e9dce9 100644 (file)
@@ -16,6 +16,7 @@ namespace TYPO3\CMS\Frontend\Resource;
 
 use Psr\Log\LoggerAwareInterface;
 use Psr\Log\LoggerAwareTrait;
+use TYPO3\CMS\Core\LinkHandling\LinkService;
 use TYPO3\CMS\Core\Resource\Exception;
 use TYPO3\CMS\Core\Resource\FileCollectionRepository;
 use TYPO3\CMS\Core\Resource\FileInterface;
@@ -181,7 +182,14 @@ class FileCollector implements \Countable, LoggerAwareInterface
     {
         if ($folderIdentifier) {
             try {
-                $folder = $this->getResourceFactory()->getFolderObjectFromCombinedIdentifier($folderIdentifier);
+                if (strpos($folderIdentifier, 't3://folder') === 0) {
+                    // a t3://folder link to a folder in FAL
+                    $linkService = GeneralUtility::makeInstance(LinkService::class);
+                    $data = $linkService->resolveByStringRepresentation($folderIdentifier);
+                    $folder = $data['folder'];
+                } else {
+                    $folder = $this->getResourceFactory()->getFolderObjectFromCombinedIdentifier($folderIdentifier);
+                }
                 if ($folder instanceof Folder) {
                     $files = $folder->getFiles(0, 0, Folder::FILTER_MODE_USE_OWN_AND_STORAGE_FILTERS, $recursive);
                     $this->addFileObjects(array_values($files));