From 3054b1bef93a8920560161721473dea4da42d40f Mon Sep 17 00:00:00 2001 From: Maxence Lange Date: Tue, 7 Jun 2022 17:54:15 -0100 Subject: [PATCH] do not generate link if no front-end Signed-off-by: Maxence Lange --- lib/Model/ModelManager.php | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/lib/Model/ModelManager.php b/lib/Model/ModelManager.php index 175214b90..6073add26 100644 --- a/lib/Model/ModelManager.php +++ b/lib/Model/ModelManager.php @@ -31,7 +31,7 @@ namespace OCA\Circles\Model; -use OCA\Circles\Tools\Traits\TNCLogger; +use Exception; use OCA\Circles\AppInfo\Application; use OCA\Circles\Db\CircleRequest; use OCA\Circles\Db\CoreQueryBuilder; @@ -57,6 +57,7 @@ use OCA\Circles\Service\InterfaceService; use OCA\Circles\Service\MembershipService; use OCA\Circles\Service\RemoteService; +use OCA\Circles\Tools\Traits\TNCLogger; use OCP\IURLGenerator; /** @@ -553,10 +554,16 @@ public function fixInstance(string $instance): string { * @return string */ public function generateLinkToCircle(string $singleId): string { - return $this->urlGenerator->linkToRoute( - $this->configService->getAppValue(ConfigService::ROUTE_TO_CIRCLE), - ['singleId' => $singleId] - ); + $path = $this->configService->getAppValue(ConfigService::ROUTE_TO_CIRCLE); + + try { + if ($path !== '') { + return $this->urlGenerator->linkToRoute($path, ['singleId' => $singleId]); + } + } catch (Exception $e) { + } + + return ''; }