openkfw / TruBudget

A blockchain-based workflow tool for efficient and transparent project management
https://openkfw.github.io/trubudget-website/
GNU General Public License v3.0
83 stars 40 forks source link

When an Ampersand is used ("&") in the project title, it is escaped as html #1853

Closed jzakotnik closed 1 week ago

jzakotnik commented 1 month ago

image

pmolnar-dev commented 3 weeks ago

@jzakotnik I would maybe suggest to forbid characters like "&" in the names of project, subprojects etc because we have to create helper function for that and basically paste it everywhere where the name with "&" is used across the app. The correct but more time consuming solution would be to add form validations to these forms so we can restrict user from entering these characters into these forms.

jzakotnik commented 3 weeks ago

I don't quite get, what is the issue in saving an ampersand in the multichain and retrieve it again? Isn't it simply escaped?

pmolnar-dev commented 3 weeks ago

I don't know. :) I do know that it is a HTML entity and the problem is that it is invalid to write "&" in a text, in XML it even breaks the validation of the file. Honestly there is not one correct approach to this. The most straight forward solution is as I said. To create form validation and forbid these special characters. Ampersand should always be written as "&amp ;" so it translates to "&". In our app it does not work because the rule is applied twice, the double conversion error. At some point when text was entered, ampersand got converted to the sequence "&amp ;". It is not ampersand itself that is the problem. It is the website that takes user's input and does not always convert it correctly.