修复同一个学生提交相同的文件后,打包下载异常的BUG

This commit is contained in:
sw 2015-01-10 17:41:50 +08:00
parent 57eb9f555f
commit bf7eaa7a80
2 changed files with 12 additions and 1 deletions

View File

@ -101,10 +101,20 @@ class ZipdownController < ApplicationController
Zip::File.open(zipfile_name, Zip::File::CREATE) do |zipfile|
input_filename.each do |filename|
flag = true
index = 1
rename_file = ic.iconv( (File.basename(filename)) ).to_s
rename_file = ic.iconv( filename_to_real( File.basename(filename))).to_s if is_attachment
zipfile.add(rename_file, filename)
begin
zipfile.add(rename_file, filename)
flag = false
rescue Exception => e
zipfile.get_output_stream('FILE_NOTICE.txt') do |os|
os.write l(:label_file_exist)
end
next
end
end
unless not_exist_file.empty?
zipfile.get_output_stream('FILE_LOST.txt') do |os|

View File

@ -2240,4 +2240,5 @@ zh:
label_contain_resource: 已包含资源:
label_quote_resource_failed: ",此资源引用失败! "
label_file_lost: 以下无法成功下载,请联系相关人员重新上传:
label_file_exist: 该作品中有重复命名文件,请通过文件名学号和姓名信息进入该作业详细界面手动下载