Handle special characters in rtn req. bookmarks #1394
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
https://eaflood.atlassian.net/browse/WATER-4685
In Add site description to rtn. req. bookmark links we added the return requirement site description to the bookmarks we display when viewing a return version with more than one requirement.
However, that change didn't account for users' adding site descriptions that include special characters, such as
" & '
.When these descriptions are included in the bookmark links, they appear like this.
Return reference 100234 - Quantities taken between points X, Y &Z
Return reference 100432 - Opposite "Old cottage" entrance
Return reference 100567 - Borehole in 'middle' field
This change updates the logic to escape these characters.
The problem is caused because the description is being added to a non-markup object
<a>
. This means Nunjucks is auto-escaping the content to protect us from an XSS attack.To tell it not to auto-escape we have to use the safe filter.