附件单独下载报错

This commit is contained in:
sw 2015-06-03 10:16:27 +08:00
parent 705094e515
commit d451f28c01
1 changed files with 2 additions and 4 deletions

View File

@ -69,7 +69,7 @@ class AttachmentsController < ApplicationController
if candown || User.current.admin? || User.current.id == @attachment.author_id if candown || User.current.admin? || User.current.id == @attachment.author_id
@attachment.increment_download @attachment.increment_download
if stale?(:etag => @attachment.digest) if stale?(:etag => @attachment.digest)
convered_file = File.join(Rails.root, "files", "convered_office", a.disk_filename + ".html") convered_file = File.join(Rails.root, "files", "convered_office", @attachment.disk_filename + ".html")
if File.exist?(convered_file) if File.exist?(convered_file)
render :text => File.open(convered_file).read render :text => File.open(convered_file).read
else else
@ -78,11 +78,9 @@ class AttachmentsController < ApplicationController
:disposition => 'attachment' #inline can open in browser :disposition => 'attachment' #inline can open in browser
end end
end end
else else
render_403 :message => :notice_not_authorized render_403 :message => :notice_not_authorized
end end
rescue => e rescue => e
redirect_to "http: //" + (Setting.host_name.to_s) +"/file_not_found.html" redirect_to "http: //" + (Setting.host_name.to_s) +"/file_not_found.html"
end end