Browse Source

Sanitise all titles simpler

pull/2643/head
Manny Dinssa 2 years ago
parent
commit
349fb942eb
  1. 9
      app/helpers/application_helper.rb

9
app/helpers/application_helper.rb

@ -2,7 +2,7 @@ module ApplicationHelper
include Pagy::Frontend include Pagy::Frontend
def browser_title(title, pagy, *resources) def browser_title(title, pagy, *resources)
title = sanitise_characters(title) title = CGI.unescapeHTML(title)
if resources.any? { |r| r.present? && r.errors.present? } if resources.any? { |r| r.present? && r.errors.present? }
"Error: #{[title, t('service_name'), 'GOV.UK'].select(&:present?).join(' - ')}" "Error: #{[title, t('service_name'), 'GOV.UK'].select(&:present?).join(' - ')}"
else else
@ -31,13 +31,6 @@ module ApplicationHelper
def notifications_to_display? def notifications_to_display?
!current_page?(notifications_path) && (authenticated_user_has_notifications? || unauthenticated_user_has_notifications?) !current_page?(notifications_path) && (authenticated_user_has_notifications? || unauthenticated_user_has_notifications?)
end end
def sanitise_characters(string)
return string unless string
CGI.unescapeHTML(string)
end
private private
def paginated_title(title, pagy) def paginated_title(title, pagy)

Loading…
Cancel
Save