Commit 4d2a59f88441f428e0cd38a67a84f6ed1089a7f6
1 parent
9b098e77
Exists in
master
Fix: 修改附件编码问题
Showing
1 changed file
with
3 additions
and
3 deletions
Show diff stats
lib/sendcloud/deliverer.rb
... | ... | @@ -66,9 +66,9 @@ module Sendcloud |
66 | 66 | attachment = rails_message.attachments.first |
67 | 67 | filename = attachment.filename |
68 | 68 | file_path = File.join(Dir.tmpdir, filename) |
69 | - file = File.new(file_path, "w") | |
70 | - file.puts(attachment.body.decoded) | |
71 | - file.close | |
69 | + File.open(file_path, "wb") do |file| | |
70 | + file.write(attachment.body.decoded) | |
71 | + end | |
72 | 72 | File.open(file_path) |
73 | 73 | end |
74 | 74 | ... | ... |