From db0ea6c6215364277cf181f7e83e53537138799d Mon Sep 17 00:00:00 2001 From: chiu Date: Wed, 3 Jun 2026 05:29:06 +0000 Subject: [PATCH] Restore PDF opening function --- app/controllers/announcements_controller.rb | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/app/controllers/announcements_controller.rb b/app/controllers/announcements_controller.rb index c23349f..8c1dfd8 100644 --- a/app/controllers/announcements_controller.rb +++ b/app/controllers/announcements_controller.rb @@ -655,8 +655,9 @@ class AnnouncementsController < ApplicationController @filename = @path.split("/").last @ext = @path.split("/").last.to_s.split(".").last # if @ext == "png" || @ext == "jpg" || @ext == "bmp" || @ext == "pdf" - # render "archives/download_file.html",:layout=>false - # else + if @ext == "pdf" + render "archives/download_file.html",:layout=>false + else if (current_site.accessibility_mode rescue false) render "archives/redirect_to_file.html",:layout=>false return @@ -666,7 +667,7 @@ class AnnouncementsController < ApplicationController send_file(@path, :type=>"application/octet-stream", :filename => @escaped_file_name, :x_sendfile=> true) return end - # end + end else render :file => "#{Rails.root}/app/views/errors/403.html", :layout => false, :status => :not_found, :content_type => 'text/html' return