Skip to content

Commit

Permalink
Merge pull request #11389 from nextcloud/backport/11383/stable14
Browse files Browse the repository at this point in the history
[stable14] do not explode when getting permissions from a FailedStorage
  • Loading branch information
blizzz authored Sep 27, 2018
2 parents 1b493b7 + 5a20ac9 commit 6eab0d0
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion apps/files_sharing/lib/Cache.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
use OC\Files\Cache\Wrapper\CacheJail;
use OC\Files\Storage\Wrapper\Jail;
use OCP\Files\Cache\ICacheEntry;
use OCP\Files\StorageNotAvailableException;

/**
* Metadata cache for shared files
Expand Down Expand Up @@ -142,7 +143,14 @@ protected function formatCacheEntry($entry, $path = null) {
} else {
$entry['path'] = $path;
}
$sharePermissions = $this->storage->getPermissions($entry['path']);

try {
$sharePermissions = $this->storage->getPermissions($entry['path']);
} catch (StorageNotAvailableException $e) {
// thrown by FailedStorage e.g. when the sharer does not exist anymore
// (IDE may say the exception is never thrown – false negative)
$sharePermissions = 0;
}
if (isset($entry['permissions'])) {
$entry['permissions'] &= $sharePermissions;
} else {
Expand Down

0 comments on commit 6eab0d0

Please sign in to comment.