From 612c4ae4a118e158d527288a9d276399874d394a Mon Sep 17 00:00:00 2001 From: BoHung Chiu Date: Sat, 4 Mar 2023 17:22:10 +0800 Subject: [PATCH] Fix filename for IE. --- app/controllers/archives_controller.rb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app/controllers/archives_controller.rb b/app/controllers/archives_controller.rb index 8055ea0..b597ab8 100644 --- a/app/controllers/archives_controller.rb +++ b/app/controllers/archives_controller.rb @@ -227,7 +227,9 @@ class ArchivesController < ApplicationController if (current_site.accessibility_mode rescue false) render "redirect_to_file",:layout=>false else - send_file(@path) + user_agent = request.user_agent.downcase + @escaped_file_name = user_agent.include?(/(msie|trident)/) ? CGI::escape(@filename) : @filename + send_file(@path, :type=>"application/octet-stream", :filename => @escaped_file_name, :x_sendfile=> true) end end rescue