diff options
-rw-r--r-- | app/models/incoming_message.rb | 15 | ||||
-rw-r--r-- | app/views/request/_correspondence.rhtml | 2 |
2 files changed, 15 insertions, 2 deletions
diff --git a/app/models/incoming_message.rb b/app/models/incoming_message.rb index 31b6eca35..f1ae68410 100644 --- a/app/models/incoming_message.rb +++ b/app/models/incoming_message.rb @@ -19,7 +19,7 @@ # Copyright (c) 2007 UK Citizens Online Democracy. All rights reserved. # Email: francis@mysociety.org; WWW: http://www.mysociety.org/ # -# $Id: incoming_message.rb,v 1.6 2007-12-11 12:16:29 francis Exp $ +# $Id: incoming_message.rb,v 1.7 2007-12-17 19:35:13 francis Exp $ class IncomingMessage < ActiveRecord::Base belongs_to :info_request @@ -44,6 +44,19 @@ class IncomingMessage < ActiveRecord::Base # Use date it arrived (created_at) if mail itself doesn't have Date: header self.mail.date || self.created_at end + + # Use this when displaying the body text + def sanitised_body + body = self.mail.body.dup + + # Remove any email addresses - we don't want bounce messages to leak out + # either the requestor's email address or the request's response email + # address out onto the internet + rx = Regexp.new(MySociety::Validate.email_match_regexp) + body.gsub!(rx, "...@...") + + return body + end end diff --git a/app/views/request/_correspondence.rhtml b/app/views/request/_correspondence.rhtml index 5695c87ff..7a85bb627 100644 --- a/app/views/request/_correspondence.rhtml +++ b/app/views/request/_correspondence.rhtml @@ -21,7 +21,7 @@ </p> <% elsif (correspondence.class.to_s == 'IncomingMessage') incoming_message = correspondence%> - <%= render :partial => 'bubble', :locals => { :body => incoming_message.mail.body } %> + <%= render :partial => 'bubble', :locals => { :body => incoming_message.sanitised_body } %> <p class="xspeaker"> <%= incoming_message.mail.friendly_from %> |