Skip to content

Commit 89e15c8

Browse files
Merge pull request nextcloud#48400 from nextcloud/backport/48366/stable29
2 parents 6046934 + dfd0b9d commit 89e15c8

File tree

1 file changed

+13
-6
lines changed

1 file changed

+13
-6
lines changed

apps/files_sharing/lib/External/Storage.php

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -384,14 +384,21 @@ public function isSharable($path): bool {
384384

385385
public function getPermissions($path): int {
386386
$response = $this->propfind($path);
387+
if ($response === false) {
388+
return 0;
389+
}
390+
391+
$ocsPermissions = $response['{http://open-collaboration-services.org/ns}share-permissions'] ?? null;
392+
$ocmPermissions = $response['{http://open-cloud-mesh.org/ns}share-permissions'] ?? null;
393+
$ocPermissions = $response['{http://owncloud.org/ns}permissions'] ?? null;
387394
// old federated sharing permissions
388-
if (isset($response['{http://open-collaboration-services.org/ns}share-permissions'])) {
389-
$permissions = (int)$response['{http://open-collaboration-services.org/ns}share-permissions'];
390-
} elseif (isset($response['{http://open-cloud-mesh.org/ns}share-permissions'])) {
395+
if ($ocsPermissions !== null) {
396+
$permissions = (int)$ocsPermissions;
397+
} elseif ($ocmPermissions !== null) {
391398
// permissions provided by the OCM API
392-
$permissions = $this->ocmPermissions2ncPermissions($response['{http://open-collaboration-services.org/ns}share-permissions'], $path);
393-
} elseif (isset($response['{http://owncloud.org/ns}permissions'])) {
394-
return $this->parsePermissions($response['{http://owncloud.org/ns}permissions']);
399+
$permissions = $this->ocmPermissions2ncPermissions($ocmPermissions, $path);
400+
} elseif ($ocPermissions !== null) {
401+
return $this->parsePermissions($ocPermissions);
395402
} else {
396403
// use default permission if remote server doesn't provide the share permissions
397404
$permissions = $this->getDefaultPermissions($path);

0 commit comments

Comments
 (0)