附件单独下载报错
This commit is contained in:
parent
705094e515
commit
d451f28c01
|
@ -65,11 +65,11 @@ class AttachmentsController < ApplicationController
|
||||||
def download
|
def download
|
||||||
# modify by nwb
|
# modify by nwb
|
||||||
# 下载添加权限设置
|
# 下载添加权限设置
|
||||||
candown = attachment_candown @attachment
|
candown = attachment_candown @attachment
|
||||||
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…
Reference in New Issue