Skip to content

Commit

Permalink
Add patch to raw email for edge case issue
Browse files Browse the repository at this point in the history
Fixes issue where spaces are included before some email headers.

See mysociety/alaveteli#6853
  • Loading branch information
gbp committed Mar 8, 2022
1 parent 7da62fc commit a63af91
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions lib/model_patches.rb
Original file line number Diff line number Diff line change
Expand Up @@ -153,4 +153,18 @@ def is_foi_officer?(user)

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

end

0 comments on commit a63af91

Please sign in to comment.