Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
VanessaVenti opened this issue Oct 23, 2024 · 1 comment
Labels

Comments

@VanessaVenti
Copy link

VanessaVenti commented Oct 23, 2024

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 &

@corylown
Copy link
Contributor

corylown commented Oct 23, 2024

Not sure why, but Spotlight is sanitizing the description before it's saved in the database:

before_save :sanitize_description, if: :description_changed?

def sanitize_description
self.description = ::Rails::Html::FullSanitizer.new.sanitize(description)
end

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.

@corylown corylown changed the title Bug: Ampersands do not display properly on exhibit cards Bug: Ampersands in the exhibit description do not display properly on exhibit cards Oct 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants