diff options
author | Peter Collingbourne <peter@pcc.me.uk> | 2010-03-15 13:27:16 +0000 |
---|---|---|
committer | Peter Collingbourne <peter@pcc.me.uk> | 2010-03-15 22:12:31 +0000 |
commit | d29fd88e3c54a5a5a94b29d16cb46dd859b59e05 (patch) | |
tree | 8109682c23c3c9276f09d663ab8f3c978a490c66 /app/models/incoming_message.rb | |
parent | 062849c75d5c7b4b83772a212a8a871c5d8433f7 (diff) |
Do not binary mask the pdf if pdftk silently fails producing no output
Diffstat (limited to 'app/models/incoming_message.rb')
-rw-r--r-- | app/models/incoming_message.rb | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/app/models/incoming_message.rb b/app/models/incoming_message.rb index 8ea4f0fb7..29dfb4089 100644 --- a/app/models/incoming_message.rb +++ b/app/models/incoming_message.rb @@ -543,7 +543,7 @@ class IncomingMessage < ActiveRecord::Base uncompressed_text = child.read() end # if we managed to uncompress the PDF... - if !uncompressed_text.nil? + if !uncompressed_text.nil? && !uncompressed_text.empty? # then censor stuff (making a copy so can compare again in a bit) censored_uncompressed_text = uncompressed_text.dup self._binary_mask_stuff_internal!(censored_uncompressed_text) @@ -556,7 +556,7 @@ class IncomingMessage < ActiveRecord::Base child.close_write() recompressed_text = child.read() end - if !recompressed_text.nil? + if !recompressed_text.nil? && !recompressed_text.empty? text[0..-1] = recompressed_text # [0..-1] makes it change the 'text' string in place end end |