mirror of
https://github.com/redmine/redmine.git
synced 2026-02-04 13:50:02 +01:00
The result of Attachment.latest_attach is unstable if attachments have the same timestamp (#34999).
Patch by Pavel Rosický. git-svn-id: http://svn.redmine.org/redmine/trunk@20923 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user