Project

General

Profile

Actions

Bug #92527

open

f:link.typolink does not respect additionalParams

Added by Chris no-lastname-given over 4 years ago. Updated 15 days ago.

Status:
Under Review
Priority:
Should have
Assignee:
-
Category:
-
Target version:
-
Start date:
2020-10-09
Due date:
% Done:

0%

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

Description

The `additionalParams` parameter in the `typolink` viewhelper is not respected.

Using the example from the [documentation](https://docs.typo3.org/other/typo3/view-helper-reference/10.4/en-us/typo3/fluid/latest/Link/Typolink.html) it returns the following link:

<f:link.typolink parameter="{link}" additionalParams="&u=b" 
    target="_blank" 
    class="ico-class" title="some title" 
    additionalAttributes="{type:'button'}" 
    useCacheHash="true" 
>
   Linktext
</f:link.typolink>

This translates to

<a href="myfile.doc" title="some title" target="_blank" class="ico-class" type="button">Linktext</a>

The `u=b` is not added to the link.

Debugging the variable `$typoLinkParameter` in the viewhelper (line 130) retuns

file:1414 _blank ico-class "some title" &u=b

Related issues 1 (0 open1 closed)

Related to TYPO3 Core - Task #106063: Test f:link.typolink additionalParams behaviorResolved2025-02-03

Actions
Actions #1

Updated by Riccardo De Contardi almost 4 years ago

  • Status changed from New to Needs Feedback

I am looking at https://stackoverflow.com/questions/57558916/fluid-typolink-viewhelper-ignores-additionalparams-attribute)

and I wonder if the documentation is correct...

could you try with:

additionalParams="{name: 'value'}" 

Id est:

<f:link.typolink parameter="{link}" additionalParams="{u:'b'}" 
    target="_blank" 
    class="ico-class" title="some title" 
    additionalAttributes="{type:'button'}" 
    useCacheHash="true" 
>
   Linktext
</f:link.typolink>
Actions #2

Updated by Chris no-lastname-given almost 4 years ago

In the meantime, this issue seems to be fixed. With TYPO3 10.4.14 it is all working, like described in the documentation. So the following is right:

additionalParams="&u=b" 

This issue can be closed.

Actions #3

Updated by Chris no-lastname-given almost 4 years ago

One additional note:

If you link to a file (parameter="t3://file?uid=8"), the "additionalParams" is not respected, but I guess, this is expected behaviour.

Actions #4

Updated by Riccardo De Contardi almost 4 years ago

  • Status changed from Needs Feedback to Closed

@Chris no-lastname-given thank you for your findings

Closing the issue.

Actions #5

Updated by Johannes Rebhan about 1 month ago

  • TYPO3 Version changed from 10 to 13

This came back in V13 LTS

                            <f:link.typolink parameter="{settings.deleteProfileLink}" parts-as="linkMeta" target="_blank" additionalParams="&u=b"><span>{linkMeta.title}</span></f:link.typolink>


This will not result in a link including &u=b. It ignores additionalParams completely.
Actions #6

Updated by Garvin Hicking about 1 month ago

@Johannes Rebhan Please open a fresh ticket for this, if this is a regression. It would help if you could specifically mention from which to which release this last worked and when it broke.

There do not seem to be unit/functional tests for f:link.typolink around using this 'additionalParams' attribute, so this can very well have been broken, I agree.

Actions #7

Updated by Oliver Hader 16 days ago

  • Related to Task #106063: Test f:link.typolink additionalParams behavior added
Actions #8

Updated by Oliver Hader 16 days ago ยท Edited

I've created https://review.typo3.org/c/Packages/TYPO3.CMS/+/87993 to verify & document the current behavior. I was not able to reproduce the statement, that f:link.typolink would ignore additionalParams - that does not seem to be the case.

Since this ticket was closed already, please create a new issue providing more details on how to reproduce the behavior you described. Thanks!

Actions #9

Updated by Johannes Rebhan 15 days ago

Here a test case that "fails" to add the additionalParams:

    <f:link.typolink parameter="https://www.test.com _blank" parts-as="parts" additionalParams="&u=b">{parts.title}</f:link.typolink>

Reason why that is not expected/robust behaviour? If you let an editor add a base URL, base link for some external resources, but you need to modify the calling URL based on other configuration in that content element, then you can't add them directly into the url, because the string is coming from a Typolink field, which also adds title, css class, target in the link text. That's why it would be helpful, useful, if the setting would also apply to pure external text links.

Actions #10

Updated by Gerrit Code Review 15 days ago

  • Status changed from Closed to Under Review

Patch set 1 for branch main of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/88014

Actions #11

Updated by Garvin Hicking 15 days ago

I had to abandon the patch approach.

additionalParams has been implemented to NOT apply to external links since at least TYPO3 6.2 - such a behavioral change might lead to leaking sensitive internal URI arguments:

https://docs.typo3.org/m/typo3/reference-typoscript/6.2/en-us/Functions/Typolink/Index.html

The LinkBuilder cannot easily be enhanced with a new attribute like "externalAdditionalParams" (because of the various input formats).

I think the best route to go for an implementation like this is to add a new PSR-14 event like "ModifyPageLinkConfigurationEvent" also to the ExternalUrlLinkBuilder, so that additional parameters can be added on PHP-side, without affecting existing VH/TS implementations.

Actions

Also available in: Atom PDF