Skip to content

Commit 78fd4e6

Browse files
committed
fixup: small fixes
Signed-off-by: Salvatore Martire <[email protected]>
1 parent 7d7bea9 commit 78fd4e6

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

apps/files_sharing/lib/External/MountProvider.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
use OCP\IUser;
1919
use OCP\Server;
2020
use OCP\Share\IShare;
21+
use function count;
2122
use function str_starts_with;
2223
use function strlen;
2324
use function substr;
@@ -78,7 +79,7 @@ public function getMountsFromMountPoints(
7879
array $mountProviderArgs,
7980
IStorageFactory $loader,
8081
): array {
81-
if (empty($mountsInfo)) {
82+
if (\empty($mountProviderArgs)) {
8283
return [];
8384
}
8485

@@ -93,7 +94,7 @@ public function getMountsFromMountPoints(
9394
$uniqueMountOwnerIds = array_keys($uniqueMountOwnerIds);
9495

9596
// make sure the MPs belong to the same user
96-
if (count($uniqueMountOwnerIds) !== 1) {
97+
if ($user === null || count($uniqueMountOwnerIds) !== 1) {
9798
// question: what kind of exception to throw in here?
9899
throw new LogicException();
99100
}

apps/files_sharing/lib/MountProvider.php

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -286,11 +286,10 @@ public function getMountsFromMountPoints(
286286
array $mountProviderArgs,
287287
IStorageFactory $loader,
288288
): array {
289-
/**
290-
* If path and count of mount info match, we can use the getsharedwith
291-
* If we get a path passed which doesn't match the MP in the infos we
292-
* get, it means we are loading data for a collection.
293-
*/
289+
if (empty($mountProviderArgs)) {
290+
return [];
291+
}
292+
294293
$uniqueMountOwnerIds = [];
295294
$uniqueRootIds = [];
296295
$user = null;
@@ -305,7 +304,7 @@ public function getMountsFromMountPoints(
305304
$uniqueRootIds = array_keys($uniqueRootIds);
306305

307306
// make sure the MPs belong to the same user
308-
if (count($uniqueMountOwnerIds) !== 1) {
307+
if ($user === null || count($uniqueMountOwnerIds) !== 1) {
309308
// question: what kind of exception to throw in here?
310309
throw new LogicException();
311310
}

0 commit comments

Comments
 (0)