From 83043baf61bbf95c7cc10d01f1c322f56b066ad8 Mon Sep 17 00:00:00 2001 From: SylorHuang Date: Fri, 5 Jul 2019 14:43:10 +0800 Subject: [PATCH] fix bug --- app/controllers/zips_controller.rb | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/app/controllers/zips_controller.rb b/app/controllers/zips_controller.rb index 78151a78a..67c8c74f7 100644 --- a/app/controllers/zips_controller.rb +++ b/app/controllers/zips_controller.rb @@ -10,7 +10,9 @@ class ZipsController < ApplicationController service = BatchExportShixunReportService.new(@homework, @all_student_works) filename = filename_for_content_disposition(service.filename) - send_file service.zip, filename: filename, type: 'application/zip' + Rails.logger.info("################___________file_name________________###########{filename}") + Rails.logger.info("################___________service.filename________________###########{service.filename}") + send_file service.zip, filename: filename.encode(Encoding.default_external, 'gb2312'), type: 'application/zip' rescue BatchExportShixunReportService::Error => ex normal_status(-1, ex.message) end @@ -21,10 +23,7 @@ class ZipsController < ApplicationController file_name = filename_for_content_disposition(exercises.filename) - Rails.logger.info("################___________file_name________________###########{file_name}") - Rails.logger.info("################___________exercises.filename________________###########{exercises.filename}") - - send_file exercises.ex_zip, filename: file_name.encode(Encoding.default_external, 'gb2312'), type: 'application/zip' + send_file exercises.ex_zip, filename: file_name, type: 'application/zip' rescue Exception => e normal_status(-1, e.message) end