Issue Bug Closed

#96376Link Browser (RTE and inputLink) and DefaultFactory creates user_upload folder even if uploads are diabled (and it creates it in a random storage)

S P 12/17/21, 07:33 updated 01/09/25, 10:03

Description

Steps to reproduce:
  • setup.default.edit_docModuleUpload = 0
  • setup.override.edit_docModuleUpload = 0
  • clear cache
  • clear UC cache

Expected: Link panel of an RTE does not show upload fields, only the file tree.

Actually happens: Link panel of an RTE does show upload fields, alongside the file tree.

Reviews 0

No change resolves or names this issue in its commit message, and no comment links one.

History 10

  1. S P commented and changed subject userTSconfig edit_docModuleUpload = 0 is not respected in RTE link panel RTE link to file wizard creates user_upload folder even if uploads are diabled (and it creates it in a random storage) <span data-processor="relativetime" data-value="2021-12-17T10:32:20+00:00" > 12/17/21, 10:32 </span>

    Additonal information:

    • also set options.folderTree.uploadFieldsInLinkBrowser = 0

    RTE link wizard does not allow uploads then – fine. But it still creates the user_upload folder! This seems to be caused by the fact that the upload renderer that renders this file selector already gets a FolderObject passed:
    https://github.com/TYPO3/typo3/blob/f43979e74409500b731a98b39f978379669ed2e9/typo3/sysext/recordlist/Classes/View/FolderUtilityRenderer.php#L109

    (which in turn invokes LocalDriver->getDefaultFolder() where user_upload is hardcoded)

    What we try to achieve in the very end is to prevent the user_upload folder everyhwere. Because in our workflow the editors are forced to upload via file list module into normal folders and just reference files from there. Direct file uploads from sys_file_reference fields or RTE are disallowed everyhwere.

    The next problem here is that the user_upload folder is created in the first Storage that the user has in his file list. Which does not make any sense at all. We have users with multiple storages with uid > 1 (so even none of them is “fileadmin”! These user don’t see storage.uid=1 “fileadmin”). And just by opening the link wizard in an RTE creates the user_upload folder in the first displayed file storage! This does not make sense at all (even if uploads would be enabled -> maybe the user wants to upload to a different storage).

    The user_upload folder should only ever be created if an actual upload happens!

  2. S P changed subject RTE link to file wizard creates user_upload folder even if uploads are diabled (and it creates it in a random storage) Link Browser (RTE and inputLink) creates user_upload folder even if uploads are diabled (and it creates it in a random storage) <span data-processor="relativetime" data-value="2021-12-20T06:27:29+00:00" > 12/20/21, 06:27 </span>

  3. S P commented <span data-processor="relativetime" data-value="2021-12-20T06:27:59+00:00" > 12/20/21, 06:27 </span>

    Also true for inputLink TCA fields, this is a common LinkBrowser problem.

  4. S P commented <span data-processor="relativetime" data-value="2021-12-20T07:24:04+00:00" > 12/20/21, 07:24 </span>

    The Link Browser controller and Fluid Templates are totally fine without receiving a pre-selected folder.

    But the BackendUserAuthentication accesses the FAL API (LocalDriver in the end), which has the creation of the user_upload folder hardcoded.

    The only way to currently circumvent this would be to set options.defaultUploadFolder = x:/ – however x must be a uid of a storage. This is not possible if you have hundreds of BE users each having access to different sets of storage uids.

    I see four approaches here:
    • Either make it valid to have no upload directory in the FAL API / LocalDriver (as said: for Link Browser this is already valid).
    • Provide a special key for the combined identifier to always pick the first storage of the current user, like options.defaultUploadFolder = first:/ which would select the root of first storage that the user has access to.
    • provide an Event before any calls to LocalDriver are done to be able to shortcut the creation of the user_upload folder
    • Make it possible to define a custom default upload fodler for the LocalDriver instead of teh hardcoded /user_upload/. For me it would be enough to set it to / (of the current storage).
  5. S P commented <span data-processor="relativetime" data-value="2021-12-20T08:00:32+00:00" > 12/20/21, 08:00 </span>

    For the reference, I now workaround it like this:

    <?php
    declare(strict_types=1);
    
    namespace MyVendor\MyProject\Patches\FalApi;
    
    class LocalDriver extends \TYPO3\CMS\Core\Resource\Driver\LocalDriver
    {
        public function getDefaultFolder(): string
        {
            return '/';
        }
    }

    And in LocalConfiguration.php :

    'SYS' => [
        'fal' => [
            'registeredDrivers' => [
                'Local' => [
                    'class' => \MyVendor\MyProject\Patches\FalApi\LocalDriver::class
                ]
            ]
        ]
    ]
  6. S P commented and changed subject Link Browser (RTE and inputLink) creates user_upload folder even if uploads are diabled (and it creates it in a random storage) Link Browser (RTE and inputLink) and DefaultFactory creates user_upload folder even if uploads are diabled (and it creates it in a random storage) <span data-processor="relativetime" data-value="2021-12-21T09:28:30+00:00" > 12/21/21, 09:28 </span>

    We just noticed that the DefaultFactory of the Core FolderStructure also has user_upload as a default node. Why is this?

    It also has importexport as a default node, even when ext:impexp is not even installed…

    All these directories are no “default” directories, they are only needed in very special scenarios:
    • Upload enabled for BE users at all with no other special folder configured (and then the FAL API creates the directory on-the-fly anyways)
    • ext:impexp installed (and I bet thsi extension creates it also on-the-fly, did not verify it because we don’t use it)

    Why are these folders marked as “default”?

  7. S P commented <span data-processor="relativetime" data-value="2025-01-09T08:33:14+00:00" > 01/09/25, 08:33 </span>

    This seems to work on v13. I could not reproduce getting the user_upload folder being generated if upload buttons are disabled via user TSconfig globally.

    It is still a “default factory folder”, however, which seems wrong to me. But as long as it does not get randomly recreated anymore while clicking in the BE GUI, after the initial setup was done once and the folder deleted, I consider this behaviour fixed.

  8. Oliver Bartsch commented and changed status New Closed <span data-processor="relativetime" data-value="2025-01-09T10:03:59+00:00" > 01/09/25, 10:03 </span>

    Closed as requested by the author. In case you encounter this again, please feel free to contact me or create a new issue with reference to this one.