From d451f28c01d7f36700c5b5e056060e7bbe6a4e09 Mon Sep 17 00:00:00 2001 From: sw <939547590@qq.com> Date: Wed, 3 Jun 2015 10:16:27 +0800 Subject: [PATCH] =?UTF-8?q?=E9=99=84=E4=BB=B6=E5=8D=95=E7=8B=AC=E4=B8=8B?= =?UTF-8?q?=E8=BD=BD=E6=8A=A5=E9=94=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/attachments_controller.rb | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/app/controllers/attachments_controller.rb b/app/controllers/attachments_controller.rb index c33560b04..662a85fe1 100644 --- a/app/controllers/attachments_controller.rb +++ b/app/controllers/attachments_controller.rb @@ -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