Merge pull request #7348 from nextcloud/filterout_shares_of_nonexisting_users
Check if the owner of a share exists
This commit is contained in:
commit
1287da8a38
2 changed files with 7 additions and 0 deletions
|
@ -29,6 +29,7 @@
|
||||||
|
|
||||||
namespace OCA\DAV\Connector\Sabre;
|
namespace OCA\DAV\Connector\Sabre;
|
||||||
|
|
||||||
|
use OC\Files\Storage\FailedStorage;
|
||||||
use OCA\DAV\Connector\Sabre\Exception\Forbidden;
|
use OCA\DAV\Connector\Sabre\Exception\Forbidden;
|
||||||
use OCA\DAV\Connector\Sabre\Exception\InvalidPath;
|
use OCA\DAV\Connector\Sabre\Exception\InvalidPath;
|
||||||
use OCA\DAV\Connector\Sabre\Exception\FileLocked;
|
use OCA\DAV\Connector\Sabre\Exception\FileLocked;
|
||||||
|
@ -154,6 +155,10 @@ class ObjectTree extends CachingTree {
|
||||||
// read from cache
|
// read from cache
|
||||||
try {
|
try {
|
||||||
$info = $this->fileView->getFileInfo($path);
|
$info = $this->fileView->getFileInfo($path);
|
||||||
|
|
||||||
|
if ($info instanceof \OCP\Files\FileInfo && $info->getStorage()->instanceOfStorage(FailedStorage::class)) {
|
||||||
|
throw new StorageNotAvailableException();
|
||||||
|
}
|
||||||
} catch (StorageNotAvailableException $e) {
|
} catch (StorageNotAvailableException $e) {
|
||||||
throw new \Sabre\DAV\Exception\ServiceUnavailable('Storage is temporarily not available');
|
throw new \Sabre\DAV\Exception\ServiceUnavailable('Storage is temporarily not available');
|
||||||
} catch (StorageInvalidException $e) {
|
} catch (StorageInvalidException $e) {
|
||||||
|
|
|
@ -174,6 +174,8 @@ class ObjectTreeTest extends \Test\TestCase {
|
||||||
$fileInfo->expects($this->once())
|
$fileInfo->expects($this->once())
|
||||||
->method('getName')
|
->method('getName')
|
||||||
->will($this->returnValue($outputFileName));
|
->will($this->returnValue($outputFileName));
|
||||||
|
$fileInfo->method('getStorage')
|
||||||
|
->willReturn($this->createMock(\OC\Files\Storage\Common::class));
|
||||||
|
|
||||||
$view->expects($this->once())
|
$view->expects($this->once())
|
||||||
->method('getFileInfo')
|
->method('getFileInfo')
|
||||||
|
|
Loading…
Reference in a new issue