]> source.dussan.org Git - nextcloud-server.git/commitdiff
Always sort shares in a reliable way 21311/head
authorJoas Schilling <coding@schilljs.com>
Mon, 8 Jun 2020 12:47:15 +0000 (14:47 +0200)
committerJoas Schilling <coding@schilljs.com>
Mon, 8 Jun 2020 12:47:15 +0000 (14:47 +0200)
Signed-off-by: Joas Schilling <coding@schilljs.com>
apps/files_sharing/lib/MountProvider.php
lib/public/Share/IShare.php

index 43306fe2e7e282610cbbb326ff45f871009e68cf..82d74479d4b8a73ecf6e36314d94c79ae0886e89 100644 (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;
                }
index b4d66614ceeb06475b553872578ae2a07a2d7a53..12b807400ff6ce6bbfa39136f67b3a3c64298280 100644 (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
         */