diff --git a/app/controllers/zipdown_controller.rb b/app/controllers/zipdown_controller.rb index 3612bf7a4..982e43b7b 100644 --- a/app/controllers/zipdown_controller.rb +++ b/app/controllers/zipdown_controller.rb @@ -78,7 +78,7 @@ class ZipdownController < ApplicationController # 需要将所有homework.attachments遍历加入zip # 并且返回zip路径 homeattach.attachments.each do |attach| - homeworks_attach_path << attach.diskfile#.to_s.slice((length+1)..-1) + homeworks_attach_path << attach.diskfile if File.exist?(attach.diskfile) end zipping("#{homeattach.user.lastname}#{homeattach.user.firstname}_#{((homeattach.user.user_extensions.nil? || homeattach.user.user_extensions.student_id.nil?) ? "" : homeattach.user.user_extensions.student_id)}_#{Time.now.to_i.to_s}.zip", homeworks_attach_path, OUTPUT_FOLDER, true) end