Fix filename for IE.

This commit is contained in:
BoHung Chiu 2023-03-04 17:22:10 +08:00
parent abd411a118
commit 612c4ae4a1
1 changed files with 3 additions and 1 deletions

View File

@ -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