Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 13 additions & 6 deletions lib/Model/FileCacheWrapper.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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');
}


Expand Down
5 changes: 5 additions & 0 deletions lib/ShareByCircleProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -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]);
}
}
}

Expand Down