修復ie下載中文亂碼

This commit is contained in:
邱博亞 2023-05-19 21:05:00 +08:00
parent dee431eedf
commit 151748bcb8
1 changed files with 3 additions and 1 deletions

View File

@ -665,7 +665,9 @@ class AnnouncementsController < ApplicationController
render "archives/redirect_to_file.html",:layout=>false
return
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)
return
end
end