diff --git a/lib/private/OCM/OCMDiscoveryService.php b/lib/private/OCM/OCMDiscoveryService.php index f2c914dd0394a..8ff5c188867d7 100644 --- a/lib/private/OCM/OCMDiscoveryService.php +++ b/lib/private/OCM/OCMDiscoveryService.php @@ -100,19 +100,19 @@ public function discover(string $remote, bool $skipCache = false): IOCMProvider $provider = new OCMProvider(); if (!$skipCache) { - try { - $cached = $this->cache->get($remote); - if ($cached === false) { - throw new OCMProviderException('Previous discovery failed.'); - } + $cached = $this->cache->get($remote); + if ($cached === false) { + throw new OCMProviderException('Previous discovery failed.'); + } - if ($cached !== null) { + if ($cached !== null) { + try { $provider->import(json_decode($cached, true, 8, JSON_THROW_ON_ERROR) ?? []); $this->remoteProviders[$remote] = $provider; return $provider; + } catch (JsonException|OCMProviderException $e) { + $this->logger->warning('cache issue on ocm discovery', ['exception' => $e]); } - } catch (JsonException|OCMProviderException $e) { - $this->logger->warning('cache issue on ocm discovery', ['exception' => $e]); } }