commit b2a017c11351c0d8d6120eb7441bf2864859cde1
parent e9c424512e7597f0f53f34960a539e334e8e9306
Author: Johannes Larsen <johs.a.larsen@gmail.com>
Date: Sat, 7 Dec 2013 18:44:31 +0100
flush temporary attachment files before viewing
I was having problems with the temporary attachment files being empty
when external programs (vim and w3m, and using system(), so blocking)
opened them from my mime-view hook. Flushing the content before yielding
in Attachment#write_to_disk fixes the problem for all the cases where I
encountered the problem.
Signed-off-by: Johannes Larsen
Diffstat:
1 file changed, 1 insertion(+), 0 deletions(-)
diff --git a/lib/sup/message_chunks.rb b/lib/sup/message_chunks.rb
@@ -205,6 +205,7 @@ EOS
begin
file = Tempfile.new(["sup", Shellwords.escape(@filename.gsub("/", "_")) || "sup-attachment"])
file.print @raw_content
+ file.flush
yield file if block_given?
return file.path
ensure