From: wmorgan Date: Wed, 3 Oct 2007 19:52:07 +0000 (+0000) Subject: fix write_to_disk error in attachment hook handling X-Git-Url: https://git.cworth.org/git?a=commitdiff_plain;h=ed1b3629715f85bda6b69f1c11c6957471c0f7c2;p=sup fix write_to_disk error in attachment hook handling git-svn-id: svn://rubyforge.org/var/svn/sup/trunk@599 5c8cc53c-5e98-4d25-b20a-d8db53a31250 --- diff --git a/lib/sup/message-chunks.rb b/lib/sup/message-chunks.rb index 276a61d..de7d4b5 100644 --- a/lib/sup/message-chunks.rb +++ b/lib/sup/message-chunks.rb @@ -77,13 +77,18 @@ EOS def expandable?; !viewable? end def viewable?; @lines.nil? end def view! + path = write_to_disk + system "/usr/bin/run-mailcap --action=view #{@content_type}:#{path} >& /dev/null" + $? == 0 + end + + def write_to_disk file = Tempfile.new "redwood.attachment" file.print @raw_content file.close - system "/usr/bin/run-mailcap --action=view #{@content_type}:#{file.path} >& /dev/null" - $? == 0 + file.path end - + ## used when viewing the attachment as text def to_s @lines || @raw_content