LandRegistry / govuk-frontend-jinja

GOV.UK Frontend Jinja Macros
https://pypi.org/project/govuk-frontend-jinja/
MIT License
34 stars 13 forks source link

Templates use lower filter on values where it should not #82

Open tim-s-ccs opened 6 months ago

tim-s-ccs commented 6 months ago

Describe the bug Within some of the templates the lower filter is used where it should not be. The affect components are:

In the "Exist this page" component, the lower filter is being applied to the attributes tag:

{{ attribute }}="{{ value | lower }}"{% endfor %}

As the user passes in the attributes we should not mutate what they are otherwise there could be unexpected consequences. I realises this was required to pass a test but perhaps the test needs to be updated (can be extended as part of my work in https://github.com/LandRegistry/govuk-frontend-jinja/pull/81)

In the "Select" component, the lower filter is being applied to the value:

<option {%- if item.value is not undefined %} value="{{ item.value | lower }}"{% endif %}

Again, as the user passes in the values we should not mutate them are otherwise there could be unexpected consequences (which is how I discovered this bug).

Expected behavior

Additional context I'm happy to help and contribute to this project so if you want to make changes I can

masuk-kazi98 commented 2 months ago

Any updates on this? We also require the removal of 'lower' from the options tag as it affects how we process the user selections for certain data sets