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