From dd98a9001a5cfa417b1e7320fa0982b3d8a2a975 Mon Sep 17 00:00:00 2001 From: Graeme Porteous Date: Tue, 8 Mar 2022 12:17:51 +0000 Subject: [PATCH] Add patch to raw email for edge case issue Fixes issue where spaces are included before some email headers. See https://github.com/mysociety/asktheeu-theme/pull/120 See https://github.com/mysociety/alaveteli/issues/6853 --- lib/model_patches.rb | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/lib/model_patches.rb b/lib/model_patches.rb index c00a5317..6787c936 100644 --- a/lib/model_patches.rb +++ b/lib/model_patches.rb @@ -86,6 +86,18 @@ def is_school? end end + RawEmail.class_eval do + alias original_data data + + def data + original_data.sub(/ + ^(Date: [^\n]+\n) + \s+(To: [^\n]+\n) + \s+(From: [^\n]+) + /x, '\1\2\3') + end + end + ReplyToAddressValidator.invalid_reply_addresses = %w( FOIResponses@homeoffice.gsi.gov.uk FOIResponses@homeoffice.gov.uk