附件单独下载报错
This commit is contained in:
parent
705094e515
commit
d451f28c01
|
@ -65,11 +65,11 @@ class AttachmentsController < ApplicationController
|
|||
def download
|
||||
# modify by nwb
|
||||
# 下载添加权限设置
|
||||
candown = attachment_candown @attachment
|
||||
candown = attachment_candown @attachment
|
||||
if candown || User.current.admin? || User.current.id == @attachment.author_id
|
||||
@attachment.increment_download
|
||||
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)
|
||||
render :text => File.open(convered_file).read
|
||||
else
|
||||
|
@ -78,11 +78,9 @@ class AttachmentsController < ApplicationController
|
|||
:disposition => 'attachment' #inline can open in browser
|
||||
end
|
||||
end
|
||||
|
||||
else
|
||||
render_403 :message => :notice_not_authorized
|
||||
end
|
||||
|
||||
rescue => e
|
||||
redirect_to "http: //" + (Setting.host_name.to_s) +"/file_not_found.html"
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue