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
def get_file
@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'
return
end
begin
end
file = BulletinFile.find(params[:id])
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'
@ -517,15 +517,19 @@ class AnnouncementsController < ApplicationController
else
if (current_site.accessibility_mode rescue false)
render "archives/redirect_to_file.html",:layout=>false
return
else
send_file(@path)
return
end
end
else
render :file => "#{Rails.root}/app/views/errors/403.html", :layout => false, :status => :not_found, :content_type => 'text/html'
return
end
rescue
render :file => "#{Rails.root}/app/views/errors/404.html", :layout => false, :status => :not_found, :content_type => 'text/html'
return
end
end
def show_local_announcement(uid, is_preview)