fix error

This commit is contained in:
chiu 2021-08-04 20:17:56 +08:00
parent e71289398b
commit c443dddeea
1 changed files with 7 additions and 3 deletions

View File

@ -497,11 +497,11 @@ class AnnouncementsController < ApplicationController
end end
def get_file def get_file
@url = request.path @url = request.path
if @url.match(/\/\.\./) begin
if @url.match(/\/\.\./)
render :file => "#{Rails.root}/app/views/errors/404.html", :layout => false, :status => :not_found, :content_type => 'text/html' render :file => "#{Rails.root}/app/views/errors/404.html", :layout => false, :status => :not_found, :content_type => 'text/html'
return return
end end
begin
file = BulletinFile.find(params[:id]) file = BulletinFile.find(params[:id])
if File.basename(file.file.path) != URI.decode(params[:f_name]) if File.basename(file.file.path) != URI.decode(params[:f_name])
render :file => "#{Rails.root}/app/views/errors/403.html", :layout => false, :status => :not_found, :content_type => 'text/html' render :file => "#{Rails.root}/app/views/errors/403.html", :layout => false, :status => :not_found, :content_type => 'text/html'
@ -517,15 +517,19 @@ class AnnouncementsController < ApplicationController
else else
if (current_site.accessibility_mode rescue false) if (current_site.accessibility_mode rescue false)
render "archives/redirect_to_file.html",:layout=>false render "archives/redirect_to_file.html",:layout=>false
return
else else
send_file(@path) send_file(@path)
return
end end
end end
else else
render :file => "#{Rails.root}/app/views/errors/403.html", :layout => false, :status => :not_found, :content_type => 'text/html' render :file => "#{Rails.root}/app/views/errors/403.html", :layout => false, :status => :not_found, :content_type => 'text/html'
return
end end
rescue rescue
render :file => "#{Rails.root}/app/views/errors/404.html", :layout => false, :status => :not_found, :content_type => 'text/html' render :file => "#{Rails.root}/app/views/errors/404.html", :layout => false, :status => :not_found, :content_type => 'text/html'
return
end end
end end
def show_local_announcement(uid, is_preview) def show_local_announcement(uid, is_preview)