diff options
author | Joas Schilling <coding@schilljs.com> | 2020-06-08 14:47:15 +0200 |
---|---|---|
committer | Joas Schilling <coding@schilljs.com> | 2020-06-08 14:47:15 +0200 |
commit | 56b04c65f72664d94050b72eb633bf279f674af3 (patch) | |
tree | 82ef6b1e4f1ea9decbff8b78905876e40f5f426a /apps | |
parent | fd62a5b59a08e139417f8271f95e8d56e2090ccb (diff) | |
download | nextcloud-server-56b04c65f72664d94050b72eb633bf279f674af3.tar.gz nextcloud-server-56b04c65f72664d94050b72eb633bf279f674af3.zip |
Always sort shares in a reliable way
Signed-off-by: Joas Schilling <coding@schilljs.com>
Diffstat (limited to 'apps')
-rw-r--r-- | apps/files_sharing/lib/MountProvider.php | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/apps/files_sharing/lib/MountProvider.php b/apps/files_sharing/lib/MountProvider.php index 43306fe2e7e..82d74479d4b 100644 --- a/apps/files_sharing/lib/MountProvider.php +++ b/apps/files_sharing/lib/MountProvider.php @@ -156,10 +156,12 @@ class MountProvider implements IMountProvider { // sort by stime, the super share will be based on the least recent share foreach ($tmp as &$tmp2) { @usort($tmp2, function ($a, $b) { - if ($a->getShareTime() <= $b->getShareTime()) { - return -1; + $aTime = $a->getShareTime()->getTimestamp(); + $bTime = $b->getShareTime()->getTimestamp(); + if ($aTime === $bTime) { + return $a->getId() < $b->getId() ? -1 : 1; } - return 1; + return $aTime < $bTime ? -1 : 1; }); $result[] = $tmp2; } |