mirror of
https://github.com/nextcloud/server.git
synced 2026-04-22 14:50:17 -04:00
Don't crash with outdated share provider
Signed-off-by: Joas Schilling <coding@schilljs.com>
This commit is contained in:
parent
9429ba0e9a
commit
9a5a80438a
1 changed files with 23 additions and 4 deletions
|
|
@ -40,6 +40,7 @@ use OCA\FederatedFileSharing\Notifications;
|
|||
use OCA\FederatedFileSharing\TokenHandler;
|
||||
use OCA\ShareByMail\Settings\SettingsManager;
|
||||
use OCA\ShareByMail\ShareByMailProvider;
|
||||
use OCA\Talk\Share\RoomShareProvider;
|
||||
use OCP\Defaults;
|
||||
use OCP\EventDispatcher\IEventDispatcher;
|
||||
use OCP\IServerContainer;
|
||||
|
|
@ -47,6 +48,8 @@ use OCP\Share\IManager;
|
|||
use OCP\Share\IProviderFactory;
|
||||
use OCP\Share\IShare;
|
||||
use OCP\Share\IShareProvider;
|
||||
use Psr\Container\ContainerExceptionInterface;
|
||||
use Psr\Log\LoggerInterface;
|
||||
|
||||
/**
|
||||
* Class ProviderFactory
|
||||
|
|
@ -257,8 +260,15 @@ class ProviderFactory implements IProviderFactory {
|
|||
}
|
||||
|
||||
try {
|
||||
$this->roomShareProvider = $this->serverContainer->query('\OCA\Talk\Share\RoomShareProvider');
|
||||
} catch (\OCP\AppFramework\QueryException $e) {
|
||||
/**
|
||||
* @psalm-suppress UndefinedClass
|
||||
*/
|
||||
$this->roomShareProvider = $this->serverContainer->get(RoomShareProvider::class);
|
||||
} catch (\Throwable $e) {
|
||||
$this->serverContainer->get(LoggerInterface::class)->error(
|
||||
$e->getMessage(),
|
||||
['exception' => $e]
|
||||
);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
|
@ -351,8 +361,17 @@ class ProviderFactory implements IProviderFactory {
|
|||
}
|
||||
|
||||
foreach ($this->registeredShareProviders as $shareProvider) {
|
||||
/** @var IShareProvider $instance */
|
||||
$instance = $this->serverContainer->get($shareProvider);
|
||||
try {
|
||||
/** @var IShareProvider $instance */
|
||||
$instance = $this->serverContainer->get($shareProvider);
|
||||
} catch (\Throwable $e) {
|
||||
$this->serverContainer->get(LoggerInterface::class)->error(
|
||||
$e->getMessage(),
|
||||
['exception' => $e]
|
||||
);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!isset($this->shareProviders[$instance->identifier()])) {
|
||||
$this->shareProviders[$instance->identifier()] = $instance;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue