diff --git a/lib/Model/FileCacheWrapper.php b/lib/Model/FileCacheWrapper.php index 271b9fa00..7e071bf33 100644 --- a/lib/Model/FileCacheWrapper.php +++ b/lib/Model/FileCacheWrapper.php @@ -31,13 +31,13 @@ namespace OCA\Circles\Model; +use JsonSerializable; +use OCA\Circles\Db\CoreQueryBuilder; +use OCA\Circles\Exceptions\FileCacheNotFoundException; use OCA\Circles\Tools\Db\IQueryRow; use OCA\Circles\Tools\Exceptions\InvalidItemException; use OCA\Circles\Tools\IDeserializable; use OCA\Circles\Tools\Traits\TArrayTools; -use JsonSerializable; -use OCA\Circles\Db\CoreQueryBuilder; -use OCA\Circles\Exceptions\FileCacheNotFoundException; /** * Class FileCacheWrapper @@ -451,12 +451,19 @@ public function toCache(): array { * @return bool */ public function isAccessible(): bool { - if ($this->getId() === 0 || $this->getPath() === '') { + if ($this->getId() === 0) { return false; } - return !(explode('/', $this->getPath(), 2)[0] !== 'files' - && explode(':', $this->getStorage(), 2)[0] === 'home'); + $path = $this->getPath(); + [$storageType,] = explode('::', $this->getStorage(), 2); + + if ($path === '') { + // we only accept empty path on external storage + return (in_array($storageType, ['local', 'webdav', 'ftp', 'sftp', 'swift', 'smb', 'amazon'])); + } + + return !(explode('/', $path, 2)[0] !== 'files' && $storageType === 'home'); } diff --git a/lib/ShareByCircleProvider.php b/lib/ShareByCircleProvider.php index a1807fb01..48b564233 100644 --- a/lib/ShareByCircleProvider.php +++ b/lib/ShareByCircleProvider.php @@ -401,6 +401,11 @@ public function getSharesInFolder($userId, Folder $node, $reshares, $shallow = t if ($wrappedShare->getFileCache()->isAccessible()) { $result[$wrappedShare->getFileSource()][] = $wrappedShare->getShare($this->rootFolder, $this->userManager, $this->urlGenerator); + } else { + $this->logger->debug('shared document is not available anymore', ['wrappedShare' => $wrappedShare]); + if ($wrappedShare->getFileCache()->getPath() === '') { + $this->logger->notice('share is not available while path is empty. might comes from an unsupported storage.', ['wrappedShare' => $wrappedShare]); + } } }