diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/tnef.rb | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/lib/tnef.rb b/lib/tnef.rb index 2f200e3eb..ff88b0005 100644 --- a/lib/tnef.rb +++ b/lib/tnef.rb @@ -19,6 +19,7 @@ class TNEF raise IOError, "tnef exited with status #{$?.exitstatus}" end end + found = 0 Dir.new(dir).sort.each do |file| # sort for deterministic behaviour if file != "." && file != ".." file_content = File.open("#{dir}/#{file}", "r").read @@ -26,8 +27,12 @@ class TNEF attachment['content-location'] = file attachment.body = file_content main.parts << attachment + found += 1 end end + if found == 0 + raise IOError, "tnef produced no attachments" + end end main end |