From d57f5c70e9b81d30da797593af048d0b17ad745e Mon Sep 17 00:00:00 2001 From: AW-UC Date: Tue, 24 Feb 2015 23:50:38 +0100 Subject: [PATCH] Fix sorting for files that only differ in case. --- lib/private/naturalsort_defaultcollator.php | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/lib/private/naturalsort_defaultcollator.php b/lib/private/naturalsort_defaultcollator.php index 33b99d4ecbb..63136aac749 100644 --- a/lib/private/naturalsort_defaultcollator.php +++ b/lib/private/naturalsort_defaultcollator.php @@ -11,10 +11,13 @@ namespace OC; class NaturalSort_DefaultCollator { public function compare($a, $b) { - $result = strcasecmp($a, $b); - if ($result === 0) { - return 0; - } - return ($result < 0) ? -1 : 1; + $result = strcasecmp($a, $b); + if ($result === 0) { + if ($a === $b) { + return 0; + } + return ($a > $b) ? -1 : 1; + } + return ($result < 0) ? -1 : 1; } } -- 2.39.5