From 7a8ef267cadc74bc9350827d41a5a2fd0e675bec Mon Sep 17 00:00:00 2001 From: Manny Dinssa <44172848+Dinssa@users.noreply.github.com> Date: Mon, 16 Sep 2024 16:53:49 +0100 Subject: [PATCH] Remove any characters that are not alphanumeric, spaces, hyphens, underscores, apostrophes, or ampersands. --- app/helpers/application_helper.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 2a91006b0..ae682e1fc 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -34,7 +34,7 @@ module ApplicationHelper def sanitise_characters(string) return string unless string - string.tr("'", "’").tr("&", "&") + string.gsub(/[^a-zA-Z0-9\s\-\_\'\&]/, '').tr("'", "’").tr("&", "&") end private