Browse Source

Sanitise without needing html safe

pull/2643/head
Manny Dinssa 2 years ago
parent
commit
9ff2c2706f
  1. 6
      app/helpers/application_helper.rb
  2. 1
      app/helpers/title_helper.rb

6
app/helpers/application_helper.rb

@ -31,6 +31,12 @@ module ApplicationHelper
!current_page?(notifications_path) && (authenticated_user_has_notifications? || unauthenticated_user_has_notifications?)
end
def sanitise_characters(string)
return string unless string
string.gsub("'", "").gsub("&", "and")
end
private
def paginated_title(title, pagy)

1
app/helpers/title_helper.rb

@ -4,6 +4,7 @@ module TitleHelper
end
def format_title(searched, page_title, current_user, item_label, count, organisation_name)
organisation_name = sanitise_characters(organisation_name)
if searched.present?
actual_title = support_sab_nav?(current_user, organisation_name) ? organisation_name : page_title
"#{actual_title} (#{count} #{item_label} matching ‘#{searched}’)"

Loading…
Cancel
Save