Bug: Ampersands in the exhibit description do not display properly on exhibit cards
Description
Spotlight does not properly display ampersands on exhibit card descriptions. If one is typed into the exhibit description, it is displayed as & instead of "&". For example, instead of displaying "Historical & Special Collections" it displays "Historical & Special Collections" (see screenshot)
Steps to reproduce
- Type an ampersand anywhere into an exhibit's description
- View the description on the exhibit card checking to see how the ampersand displays
Expected behavior
Ampersand should display as "&" instead of &
Not sure why, but Spotlight is sanitizing the description before it's saved in the database:
https://github.com/projectblacklight/spotlight/blob/3d308497ce420fe6d2e9d825c87de95834070565/app/models/spotlight/exhibit.rb#L90 https://github.com/projectblacklight/spotlight/blob/3d308497ce420fe6d2e9d825c87de95834070565/app/models/spotlight/exhibit.rb#L151-L153
This results in & getting stored as & in the description field in the database. I'm not sure why we're doing this. The stored description will be marked unsafe and so storing the & directly in the database should be fine and then it would get properly encoded for display.
~~When implementing a fix for this we will need to consider that while the correct fix is to stop encoding the ampersand before storing it in the database we likely have many exhibits that already have the encoded ampersand stored.~~
Decision on 9/9 -- we add to the release notes that we have fixed this and that descriptions should be updated or re-saved if they have this problem.
This looks good to me! @laurensorensen I'll leave it here in QA in case you want to test it too. Feel free to move to Done after you've tested.