From 151748bcb83ab9a00b9b0413fafc22b28b8bcabb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=82=B1=E5=8D=9A=E4=BA=9E?= Date: Fri, 19 May 2023 21:05:00 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=BE=A9ie=E4=B8=8B=E8=BC=89=E4=B8=AD?= =?UTF-8?q?=E6=96=87=E4=BA=82=E7=A2=BC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/announcements_controller.rb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app/controllers/announcements_controller.rb b/app/controllers/announcements_controller.rb index 64bc8d8..fce2b0e 100644 --- a/app/controllers/announcements_controller.rb +++ b/app/controllers/announcements_controller.rb @@ -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