Issue Bug Closed

#91397PersistedAliasMapper: 404 error when linking to a detail page and linked data item is outside webroot

cosmoblonde GmbH 05/14/20, 12:42 updated 05/16/20, 12:53

Description

Hi,

due to commit https://github.com/TYPO3/TYPO3.CMS/commit/2a1bda4f7dd33dfdcd0782afd49924925a623511 it is no longer possible (since v9.5.16) to link to a detail page if the linked item is outside the webroot.
The links are generated correctly but will return a 404.

The links are configured in the site configuration yaml file as routeEnhancers using the PersistedAliasMapper.

MyDataType:
    type: Extbase
    extension: cb_test
    plugin: CB_Test
    routes:
      -
        routePath: '/{title}'
        _controller: 'Test::show'
        _arguments:
          title: idOfMyItem
    defaultController: 'Test::show'
    aspects:
      title:
        type: PersistedAliasMapper
        tableName: tx_my_test
        routeFieldName: path_segment

The detail page is within the webroot.

I have custom datatypes outside my webroot in a sysfolder. If I move the folder into the webroot, links work correctly again.

The issue is caused by the function call filterContainedInSite on line 239 in /typo3/sysext/core/Classes/Routing/Aspect/PersistedAliasMapper.php

This function is defined in /typo3/sysext/core/Classes/Routing/Aspect/SiteAccessorTrait.php and checks if the PID is inside the current site.

With multi-site installations that are using data items from a single folder for several webroots, moving folders is no solution.

Can you please adjust the PID check or add an additional configuration parameter to disable that check?

Reviews 0

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