summaryrefslogtreecommitdiffstats
path: root/apps/files_sharing
diff options
context:
space:
mode:
authorRoeland Jago Douma <rullzer@users.noreply.github.com>2020-06-11 13:23:07 +0200
committerGitHub <noreply@github.com>2020-06-11 13:23:07 +0200
commitf37be3af96ad359a4a5bfc8b1cce0adab69a15b4 (patch)
tree426a47f007ba92e70ca05deff412c8cac22bc575 /apps/files_sharing
parente146a2b7e6649d3dc7daedf3ff06252d2be30e37 (diff)
parentc63039bb83e254f0085c34c1ce2fe04c9dd2d84c (diff)
downloadnextcloud-server-f37be3af96ad359a4a5bfc8b1cce0adab69a15b4.tar.gz
nextcloud-server-f37be3af96ad359a4a5bfc8b1cce0adab69a15b4.zip
Merge pull request #21352 from nextcloud/backport/21311/stable19
[stable19] Always sort shares in a reliable way
Diffstat (limited to 'apps/files_sharing')
-rw-r--r--apps/files_sharing/lib/MountProvider.php8
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;
}