diff options
-rw-r--r-- | app/models/foi_attachment.rb | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/app/models/foi_attachment.rb b/app/models/foi_attachment.rb index 16e202bee..1f06907f1 100644 --- a/app/models/foi_attachment.rb +++ b/app/models/foi_attachment.rb @@ -47,7 +47,13 @@ class FoiAttachment < ActiveRecord::Base def body if @cached_body.nil? - @cached_body = File.open(self.filepath, "rb" ).read + begin + @cached_body = File.open(self.filepath, "rb" ).read + rescue Errno::ENOENT + # we've lost our cached attachments for some reason. Reparse them. + force = true + self.incoming_message.parse_raw_email!(force) + end end return @cached_body end |