修改第一次打包下载成功,后面打包下载失败的BUG
This commit is contained in:
parent
3c2c9149b1
commit
31ad012bee
|
@ -72,7 +72,7 @@ class ZipdownController < ApplicationController
|
||||||
homeattach.attachments.each do |attach|
|
homeattach.attachments.each do |attach|
|
||||||
homeworks_attach_path << attach.diskfile#.to_s.slice((length+1)..-1)
|
homeworks_attach_path << attach.diskfile#.to_s.slice((length+1)..-1)
|
||||||
end
|
end
|
||||||
zipping("#{homeattach.user.name}_#{homeattach.user.user_extensions.student_id}.zip", homeworks_attach_path, OUTPUT_FOLDER, true)
|
zipping("#{Time.now.to_i.to_s}_#{homeattach.user.name}_#{homeattach.user.user_extensions.student_id}.zip", homeworks_attach_path, OUTPUT_FOLDER, true)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
@ -81,7 +81,7 @@ class ZipdownController < ApplicationController
|
||||||
ic = Iconv.new('GBK//IGNORE', 'UTF-8//IGNORE')
|
ic = Iconv.new('GBK//IGNORE', 'UTF-8//IGNORE')
|
||||||
input_filename = files_paths
|
input_filename = files_paths
|
||||||
|
|
||||||
rename_zipfile = zip_name_refer ||= "homework.zip"
|
rename_zipfile = zip_name_refer ||= "#{Time.now.to_i.to_s}.zip"
|
||||||
zipfile_name = "#{output_path}/#{rename_zipfile}"
|
zipfile_name = "#{output_path}/#{rename_zipfile}"
|
||||||
|
|
||||||
Dir.mkdir(File.dirname(zipfile_name)) unless File.exist?(File.dirname(zipfile_name))
|
Dir.mkdir(File.dirname(zipfile_name)) unless File.exist?(File.dirname(zipfile_name))
|
||||||
|
|
Loading…
Reference in New Issue