Issue Bug Closed

#92355Routing always generates cHash if there are no aspects

Dmitry Dulepov 09/21/20, 11:48 updated 11/04/22, 11:02

Description

If there are no aspects, routing will always generate cHash for urls even though all parameters are successfully mapped.

Configiuration example:

  ArticleDetail:
    type: Extbase
    extension: Journal
    plugin: ArticleDetail
    routes:
      - {routePath: '/doi/{identifier}', _controller: 'Article::detail'}
    requirements:
      identifier: '[^/]+'
    defaultController: 'Article::detail'

Code that generates the link:

    <f:link.action action="detail" controller="Article" pluginName="ArticleDetail" extensionName="Journal" pageUid="{settings.params.detail}" arguments="{identifier: article.info.identifier}">
          <h4>{article.title}</h4>
    </f:link.action>

The url will look something like https://xyz.ddev.site/de/detail/doi/oi9Ahcha?cHash=xxxxxxxx This is not acceptable to the customer because in the existing TYPO3 v8 web site there were no cHash and having cHash in a newer TYPO3 version is seen as a disadvantage compared to previous TYPO3 versions.

I must tell that article identifiers are random strings, so none of stock aspects will work.

The only solution that I found is to create a dummy mapper:

class RemoveCHashAspect implements StaticMappableAspectInterface, \Countable
{
    public function generate(string $value): ?string
    {
        return $value;
    }

    public function resolve(string $value): ?string
    {
        return $value;
    }

    public function count()
    {
        return 1;
    }
}

and add it to the configuration:

    aspects:
      identifier:
        type: RemoveCHash

But this is an obvious step back from RealURL where such cases were handles smoothly since 2006. It looks strange to me that I need to create a whole class that does nothing just to get rid of cHash.

Please, fix this! cHash should not be appended when all parameters were successfully mapped to the url!

Reviews 0

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