diff --git a/lib/FilesHooks.php b/lib/FilesHooks.php index c6e1e94be..753b5bc84 100755 --- a/lib/FilesHooks.php +++ b/lib/FilesHooks.php @@ -1128,8 +1128,12 @@ protected function shareNotificationForOriginalOwners($currentOwner, $subject, $ * Get the sharee who shared the item with the currentUser */ $this->view->chroot('/' . $currentOwner . '/files'); - $mount = $this->view->getMount($path); - if (!($mount instanceof IMountPoint)) { + + try { + $mount = $this->view->getMount($path); + } catch (OCP\Files\NotFoundException $ex) { + return; + } catch (Exception $ex) { return; } diff --git a/tests/FilesHooksTest.php b/tests/FilesHooksTest.php index 1c91738a1..2b861ba8c 100755 --- a/tests/FilesHooksTest.php +++ b/tests/FilesHooksTest.php @@ -922,7 +922,7 @@ public function testShareNotificationForOriginalOwners(bool $validMountPoint, bo $this->view->expects($this->once()) ->method('getMount') ->with('/path') - ->willReturn(null); + ->willThrowException(new \OCP\Files\NotFoundException()); } self::invokePrivate($filesHooks, 'shareNotificationForOriginalOwners', ['current', 'subject', 'with', 42, 'type']); diff --git a/tests/bootstrap.php b/tests/bootstrap.php index 500feb948..79c22c690 100644 --- a/tests/bootstrap.php +++ b/tests/bootstrap.php @@ -24,7 +24,7 @@ define('PHPUNIT_RUN', 1); } -require_once __DIR__.'/../../../lib/base.php'; +require_once __DIR__.'/../../../instances/server1/lib/base.php'; // Fix for "Autoload path not allowed: .../tests/lib/testcase.php" \OC::$loader->addValidRoot(OC::$SERVERROOT . '/tests');