]> source.dussan.org Git - nextcloud-server.git/commitdiff
Fix sorting for files that only differ in case.
authorAW-UC <git@a-wesemann.de>
Tue, 24 Feb 2015 22:50:38 +0000 (23:50 +0100)
committerAW-UC <git@a-wesemann.de>
Tue, 24 Feb 2015 22:50:38 +0000 (23:50 +0100)
lib/private/naturalsort_defaultcollator.php

index 33b99d4ecbbbf808f93a8c21bec0e9a174f45952..63136aac74938f8485e62b8f939c5ffd35ee60ec 100644 (file)
@@ -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;
        }
 }