From 22d581aa38ae4e015c654356fb61d110456e69ee Mon Sep 17 00:00:00 2001 From: spag Date: Tue, 19 Feb 2013 14:05:11 +0100 Subject: preserve tiff file --- app/controllers/trigger_controller.rb | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'app/controllers') diff --git a/app/controllers/trigger_controller.rb b/app/controllers/trigger_controller.rb index 894c18b..64a5f91 100644 --- a/app/controllers/trigger_controller.rb +++ b/app/controllers/trigger_controller.rb @@ -73,16 +73,17 @@ class TriggerController < ApplicationController next end + working_path, tiff_file = File.split(fax_document.tiff) + if fax_document.store_dir != working_path + FileUtils.mkdir(fax_document.store_dir) + FileUtils.mv(fax_document.tiff, fax_document.store_dir) + fax_document.tiff = "#{fax_document.store_dir}/#{tiff_file}" + end + fax_document.document = File.open(pdf_file) fax_document.state = 'successful' if fax_document.save - Notifications.new_fax(fax_document).deliver - begin - File.delete(tiff_file) - rescue => e - logger.error "Raw fax file could not be deleted: #{tiff_file} => #{e.inspect}" - end begin File.delete(pdf_file) rescue => e -- cgit v1.2.3