From 65c461a9b46d0c48af817f2ba0215a03d9eaac19 Mon Sep 17 00:00:00 2001 From: Harry Bomrah Date: Mon, 21 Apr 2025 11:38:47 +0000 Subject: [PATCH] fix auto open pdf file --- app/controllers/archives_controller.rb | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/app/controllers/archives_controller.rb b/app/controllers/archives_controller.rb index 4d7428c..867ef4c 100644 --- a/app/controllers/archives_controller.rb +++ b/app/controllers/archives_controller.rb @@ -223,17 +223,17 @@ class ArchivesController < ApplicationController @path = file.file.file.file rescue "" @filename = File.basename(@path) @ext = @filename.split(".").last - if @ext == "png" || @ext == "jpg" || @ext == "bmp" || @ext == "pdf" - render "download_file",:layout=>false + #if @ext == "png" || @ext == "jpg" || @ext == "bmp" || @ext == "pdf" + #render "download_file",:layout=>false + #else + if (current_site.accessibility_mode rescue false) + render "redirect_to_file",:layout=>false else - if (current_site.accessibility_mode rescue false) - render "redirect_to_file",:layout=>false - else - user_agent = request.user_agent.downcase - @escaped_file_name = user_agent.match(/(msie|trident)/) ? CGI::escape(@filename) : @filename - send_file(@path, :type=>"application/octet-stream", :filename => @escaped_file_name, :x_sendfile=> true) - end + user_agent = request.user_agent.downcase + @escaped_file_name = user_agent.match(/(msie|trident)/) ? CGI::escape(@filename) : @filename + send_file(@path, :type=>"application/octet-stream", :filename => @escaped_file_name, :x_sendfile=> true) end + #end rescue redirect_to @url end