NicholasBottone / BrownClimbingWebsite

The website for Brown University Climbing
https://brownclimbingclub.com
GNU Affero General Public License v3.0
1 stars 1 forks source link

Symbols are not being rendered properly in text #9

Closed naafiyan closed 2 years ago

naafiyan commented 3 years ago

HTML encoding issue. The ' is showing up as ' Most likely an issue with other symbols too.

NicholasBottone commented 3 years ago

Not completely sure what is causing this as of right now, but it appears that the JSON that is sent from the frontend to the backend still uses apostrophes, but when the backend gets the record back from the database, the special symbols are gone. This could be a database formatting issue, or it could be something else that we can just change the way the text is rendered on the frontend.

screenshot

NicholasBottone commented 3 years ago

It seems that the culprit is express validators, which are changing some characters to their HTML counterparts when using .escape() sanitizer. We can either run .unescape() on the GET requests to undo this action when getting things back from the DB, or does mongo even require doing this (does Mongoose or even the DB handle this ok)

https://github.com/validatorjs/validator.js#sanitizers

NicholasBottone commented 2 years ago

Removed .escape() sanitizers, which are not necessary when using mongoose