aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLouise Crow <louise.crow@gmail.com>2012-12-05 18:29:43 +0000
committerLouise Crow <louise.crow@gmail.com>2012-12-05 18:29:43 +0000
commit0b8c40a57aa6f4a1da2e83c276ca523499d517e4 (patch)
treeada714daca03a1e37ae722afbc83d7da94210418
parentb1d2c3d5553cffbb87b008982b70f1d1d5203af1 (diff)
Read and write to the file in binary mode during a TNEF conversion operation.
-rw-r--r--lib/mail_handler/mail_handler.rb4
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/mail_handler/mail_handler.rb b/lib/mail_handler/mail_handler.rb
index a49ec8e8c..2909d873b 100644
--- a/lib/mail_handler/mail_handler.rb
+++ b/lib/mail_handler/mail_handler.rb
@@ -20,7 +20,7 @@ module MailHandler
def tnef_attachments(content)
attachments = []
Dir.mktmpdir do |dir|
- IO.popen("#{`which tnef`.chomp} -K -C #{dir}", "w") do |f|
+ IO.popen("#{`which tnef`.chomp} -K -C #{dir}", "wb") do |f|
f.write(content)
f.close
if $?.signaled?
@@ -33,7 +33,7 @@ module MailHandler
found = 0
Dir.new(dir).sort.each do |file| # sort for deterministic behaviour
if file != "." && file != ".."
- file_content = File.open("#{dir}/#{file}", "r").read
+ file_content = File.open("#{dir}/#{file}", "rb").read
attachments << { :content => file_content,
:filename => file }
found += 1