summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAW-UC <git@a-wesemann.de>2015-02-24 23:50:38 +0100
committerAW-UC <git@a-wesemann.de>2015-02-24 23:50:38 +0100
commitd57f5c70e9b81d30da797593af048d0b17ad745e (patch)
tree1e15c3deb09ccf22cb78b9448dc462a598c44f0e
parentbc668600cd9c44c9b1efe0d520005ad10e577a02 (diff)
downloadnextcloud-server-d57f5c70e9b81d30da797593af048d0b17ad745e.tar.gz
nextcloud-server-d57f5c70e9b81d30da797593af048d0b17ad745e.zip
Fix sorting for files that only differ in case.
-rw-r--r--lib/private/naturalsort_defaultcollator.php13
1 files 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;
}
}