Issue Bug Rejected

#105941addQueryString not working

Marc Harding 01/15/25, 13:28 updated 02/10/25, 23:10

Description

It seems to me, that the addQueryString option does not always work as excepted.

I’m using the news extension and users can filter the news by their assigned categories.
That works fine, but the selected category is not present in the pagination URLs.
It works when i add a routeEnhancers.

My problem is, that users can filter by multiple categories and building a routeEnhancers for that is quite complicated, so i’d like to just use the unresolved query string.

This is probably because of [[https://docs.typo3.org/c/typo3/cms-core/main/en-us/Changelog/12.0/Breaking-98488-TypolinkOptionAddQueryStringOnlyIncludesResolvedQueryArguments.html]] .

Just adding ‘unstrusted’ instead of ‘1’ sadly is not working for me: e. g.{f:uri.action(action:actionName, arguments:{currentPage: pagination.previousPageNumber}, addQueryString: ‘unstrusted’)} does not add the additional query string.

Example:

Current URL: example.com/news/?tx_news_pi1%5Bcontroller%5D=Category&tx_news_pi1%5BoverwriteDemand%5D%5Bcategories%5D=100&cHash=73cca….

Fluid: {f:uri.action(action:actionName, arguments:{currentPage: 1}, addQueryString: ‘unstrusted’)}

Result: example.com/news/?tx_news_pi1%5Bcontroller%5D=News&tx_news_pi1%5BcurrentPage%5D=1&cHash=1ec1….

Expected result: example.com/news/?tx_news_pi1%5Bcontroller%5D=News&tx_news_pi1%5BcurrentPage%5D=1&tx_news_pi1%5BoverwriteDemand%5D%5Bcategories%5D=100&cHash=1ec1…

Reviews 0

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

History 6

  1. Daniel Siepmann commented 01/15/25, 13:41

    We encountered the same issue with TYPO3 13 and our own extension “events”.
    We didn’t want to use “untrusted” for several reasons.

    We work around the current limitation: https://github.com/werkraum-media/events/pull/71

    TYPO3 allows configuring nested arguments in URLs, but I couldn’t find anything (within TYPO3 Docs, Symfony Docs or Code) that would provide an out-of-the-box way for a list, e.g. the categories mentioned in this issue.

    It would be cool if TYPO3 would provide a proper example within the docs on how to handle those situations.

  2. Marc Harding commented 01/15/25, 14:40

    Sorry, i had a typo in my example which i did not catch 🙈.

    “untrusted” works now but it would still be nice to have a option where one can easily whitelist additional query params (like Daniel mentioned).

  3. Oliver Hader changed category 01/15/25, 14:49

  4. Georg Ringer commented and changed status New Rejected 01/16/25, 21:23

    Hey Marc,

    thanks for creating the issue and also providing the solution.

    using untrusted is the correct way to go. If you need a more flexible solution I suggest creating the queries in your controller or a VH. as there could be more so many more configurations and variants there is currently no plan for a detailed configuration. therefore I am closing this issue. I hope you understand

  5. Andreas Kießling commented 02/10/25, 21:30

    It’s really sad to see that the pagination stuff gets more complicated with each core release.
    Using untrusted really can’t be the way to go, please don’t suggest that.
    We need a way to register valid / forwardable url params that are not part of the routing

  6. Andreas Kießling commented 02/10/25, 23:10

    So for clarification: setting it to untrusted restores the behavior from pre v12, including having invalid params from bots etc.

    If you want to avoid that, you can create the arguments for the action viewhelper in an own viewhelper, e.g. like https://gist.github.com/akiessling/41a39cbcb04948a5cfc01cd3b5380db3 and only forward the arguments that you need.