修复文件预览bug
This commit is contained in:
parent
87e7db1a4b
commit
00745f1270
|
@ -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),
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue