Project

General

Profile

Actions

Bug #88714

closed

f:link.action does not allow to render a link without a cHash when generating a dynamic route with dynamic arguments (extbase route enhancer)

Added by Denis Mir almost 5 years ago. Updated over 4 years ago.

Status:
Closed
Priority:
Should have
Assignee:
-
Category:
-
Target version:
-
Start date:
2019-07-10
Due date:
% Done:

0%

Estimated time:
TYPO3 Version:
9
PHP Version:
Tags:
Complexity:
Is Regression:
Sprint Focus:

Description

We are trying to render a dynamic route with the "f:link.action" viewhelper like this:

<f:link.action class="blog__stroy" action="show" extensionName="blog" pluginName="blog" pageUid="2" arguments="{slug: story.slug}" noCacheHash="true" target="_blank">

In this case the "noCacheHash" parameter gets ignored and the link always gets generated with the cHash.

Digging deeper I found that the route cause is the "PageRouter" which does the following in the generateUri method:

// cHash is never considered because cHash is built by this very method.
unset($originalParameters['cHash']);

In the documentation it says:

The requirements section exactly specifies what kind of parameter should be added to that route as regular expression. This way, it is configurable to only allow integer values for e.g. pagination. If the requirements are too loose, a URL signature parameter ("cHash") is added to the end of the URL which cannot be removed.

But what are "too loose requirements"? When looking at the code in the PageRouter there is not evaluation whatsoever it just does:

if ($matchedRoute && $pageRouteResult && !empty($pageRouteResult->getDynamicArguments())) {
            $cacheHash = $this->generateCacheHash($pageId, $pageRouteResult);

            if (!empty($cacheHash)) {
                $queryArguments = $pageRouteResult->getQueryArguments();
                $queryArguments['cHash'] = $cacheHash;
                $uri = $uri->withQuery(http_build_query($queryArguments, '', '&', PHP_QUERY_RFC3986));
            }
        }

So as long as there are dynamic arguments in the route the cHash is enforced. We just don't want and don't need the cHash since we only allow uuids for the dynamic argument part compared against the database. I think this is a common use case which should be supported. Always enforcing the cHash can't be the solution.

Actions #1

Updated by Susanne Moog over 4 years ago

  • Status changed from New to Needs Feedback

Hey,

as far as I understood the cHash is needed even if you are using uuids for your dynamic arguments to tell TYPO3 that those are different cached versions of your page - else you would get the same version for every uuid as no cHash is given. As long as you are not mapping those uuid arguments via route configuration I'm guessing the cHash is generated. Have you tried mapping the argument?

Actions #2

Updated by Denis Mir over 4 years ago

Hey Susanne,

You are absolutely right. When using a custom mapper (we needed a custom mapper) the cHash is finally omitted when rendering the link via f:link.action. The issue can be closed.

Actions #3

Updated by Riccardo De Contardi over 4 years ago

  • Status changed from Needs Feedback to Closed

Closed in agreement with the reporter.

If you think that this is the wrong decision, please reopen. Thank you.

Actions

Also available in: Atom PDF