diff --git a/app/controllers/attachments_controller.rb b/app/controllers/attachments_controller.rb index 662a85fe1..c8b6a6fda 100644 --- a/app/controllers/attachments_controller.rb +++ b/app/controllers/attachments_controller.rb @@ -71,7 +71,7 @@ class AttachmentsController < ApplicationController if stale?(:etag => @attachment.digest) convered_file = File.join(Rails.root, "files", "convered_office", @attachment.disk_filename + ".html") if File.exist?(convered_file) - render :text => File.open(convered_file).read + send_file convered_file, :type => 'text/html; charset=utf-8', :disposition => 'inline' else send_file @attachment.diskfile, :filename => filename_for_content_disposition(@attachment.filename), :type => detect_content_type(@attachment), diff --git a/lib/trustie/utils/office.rb b/lib/trustie/utils/office.rb index 3d58bb047..1bc18cb84 100644 --- a/lib/trustie/utils/office.rb +++ b/lib/trustie/utils/office.rb @@ -21,7 +21,7 @@ module Trustie :open_timeout => -1 ) req = resource.post :txtDes => File.new(@file, 'rb') - File.new(saved_file, "ab+") do |f| + File.open(saved_file, "wb+") do |f| f.write(req.body) end return true