spotlight icon indicating copy to clipboard operation
spotlight copied to clipboard

Bug: Ampersands in the exhibit description do not display properly on exhibit cards

Open VanessaVenti opened this issue 1 year ago • 1 comments

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) collection card

Steps to reproduce

  1. Type an ampersand anywhere into an exhibit's description
  2. View the description on the exhibit card checking to see how the ampersand displays

Expected behavior

Ampersand should display as "&" instead of &

VanessaVenti avatar Oct 23 '24 18:10 VanessaVenti

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.~~

corylown avatar Oct 23 '24 19:10 corylown

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.

corylown avatar Sep 09 '25 18:09 corylown

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.

VanessaVenti avatar Sep 16 '25 20:09 VanessaVenti