From 977bcb3d4ac53a2276506391346f9b76030d5df2 Mon Sep 17 00:00:00 2001 From: cxt <853663049@qq.com> Date: Wed, 4 Dec 2019 16:00:37 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BD=9C=E4=B8=9A=E9=99=84=E4=BB=B6=E7=9A=84?= =?UTF-8?q?=E6=98=BE=E7=A4=BA=E5=92=8C=E4=B8=8B=E8=BD=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/models/attachment.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/models/attachment.rb b/app/models/attachment.rb index 7096ca330..a918f4e0a 100644 --- a/app/models/attachment.rb +++ b/app/models/attachment.rb @@ -38,7 +38,7 @@ class Attachment < ApplicationRecord if container.is_a?(StudentWork) && author_id != User.current.id course = container&.homework_common&.course unless User.current.teacher_of_course?(course) - title = "#{Time.now.strftime('%Y-%m-%d %H:%M:%S')}_#{DCODES.sample(8).join}" + File.extname(filename) + title = "#{Time.now.strftime('%Y%m%d%H%M%S')}_#{DCODES.sample(8).join}" + File.extname(filename) end end title