Issue Bug Closed

#102246Conflicting parameters in UriBuilder

Bill Dagou 10/25/23, 04:04 updated 07/09/24, 15:19

Description

This may not be a real bug, but could be improved in the future, feel free to change the Tracker to whatever it fits. And, I believe it exists in the previous versions too.

I found this when I was working on a dropdown list providing the export links, formats is an array of the format people can export, including PDF, CSV, Excel.

<ul class="dropdown-menu">
    <f:for each="{formats}" as="format">
        <li>
            <a class="dropdown-item" href="{f:uri.action(action: 'export', arguments: '{format: format}')}">Download {format}</a>
        </li>
    </f:for>
</div>

It’s expected to get the $format parameter in the action code with the template file Export.html. However, it failed, because the TemplateView will look for the Export.[format] template instead, which means {f:uri.action(action: 'export', arguments: '{format: format}')} equals to {f:uri.action(action: 'export', format: format)}.

As a developer, I know there won’t be an easy fix for this problem, or I can simply use another parameter name in my code, but at least this can be documented somewhere.

Thank you for your time.

Reviews 3