Merge pull request #21352 from nextcloud/backport/21311/stable19

[stable19] Always sort shares in a reliable way
This commit is contained in:
Roeland Jago Douma 2020-06-11 13:23:07 +02:00 committed by GitHub
commit f37be3af96
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 4 deletions

View File

@ -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;
}

View File

@ -550,7 +550,7 @@ interface IShare {
* This is mainly for public shares. It will signal that the share page should
* hide download buttons etc.
*
* @param bool $ro
* @param bool $hide
* @return IShare
* @since 15.0.0
*/