附件单独下载报错

sw_new_course
sw 10 years ago
parent 705094e515
commit d451f28c01

@ -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

Loading…
Cancel
Save