From: Go MAEDA Date: Wed, 7 Apr 2021 05:51:11 +0000 (+0000) Subject: Merged r20923 from trunk to 4.2-stable (#34999). X-Git-Tag: 4.2.1~15 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=a7f5aea0cc595729de90f35dcf6c72e1b29ca026;p=redmine.git Merged r20923 from trunk to 4.2-stable (#34999). git-svn-id: http://svn.redmine.org/redmine/branches/4.2-stable@20924 e93f8b46-1217-0410-a6f0-8f06a7374b81 --- diff --git a/app/models/attachment.rb b/app/models/attachment.rb index 620ea89ef..241ed0d70 100644 --- a/app/models/attachment.rb +++ b/app/models/attachment.rb @@ -370,7 +370,7 @@ class Attachment < ActiveRecord::Base def self.latest_attach(attachments, filename) return unless filename.valid_encoding? - attachments.sort_by(&:created_on).reverse.detect do |att| + attachments.sort_by{|attachment| [attachment.created_on, attachment.id]}.reverse.detect do |att| filename.casecmp?(att.filename) end end