diff --git a/app/helpers/export_helper.rb b/app/helpers/export_helper.rb index 742deb85b..9771f6e1d 100644 --- a/app/helpers/export_helper.rb +++ b/app/helpers/export_helper.rb @@ -454,7 +454,7 @@ module ExportHelper #单个文件的话,不需要压缩,只改名 if homeworks_attach_path.size == 1 out_file = find_or_pack(object, work.user_id, digests.sort){ - des_path = "#{OUTPUT_FOLDER}/#{make_zip_name(work, filename.first)}_#{File.basename(homeworks_attach_path.first)}" + des_path = "#{OUTPUT_FOLDER}/#{make_zip_name(work, filename.first)}_#{work.id}}" FileUtils.cp homeworks_attach_path.first, des_path des_path } diff --git a/app/models/attachment.rb b/app/models/attachment.rb index bdd749108..1dbc86123 100644 --- a/app/models/attachment.rb +++ b/app/models/attachment.rb @@ -25,7 +25,7 @@ class Attachment < ApplicationRecord validates_length_of :description, maximum: 100 def diskfile - File.join(File.join(Rails.root, "files"), disk_directory.to_s, disk_filename.to_s) + File.join(File.join(Rails.root, "files"), disk_directory.to_s, filename.to_s) end def title