Skip to content

Commit d384071

Browse files
committed
fix: Make federation TrustedServers dependency optional in RemotePlugin
The federation app is not always installed, causing QueryException when `OCA\Federation\TrustedServers` is injected as a hard dependency. Signed-off-by: nfebe <[email protected]>
1 parent da82f6f commit d384071

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

lib/private/Collaboration/Collaborators/RemotePlugin.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ public function __construct(
3030
private IUserManager $userManager,
3131
IUserSession $userSession,
3232
private IAppConfig $appConfig,
33-
private TrustedServers $trustedServers,
33+
private ?TrustedServers $trustedServers,
3434
) {
3535
$this->userId = $userSession->getUser()?->getUID() ?? '';
3636
$this->shareeEnumeration = $this->config->getAppValue('core', 'shareapi_allow_share_dialog_user_enumeration', 'yes') === 'yes';
@@ -107,7 +107,7 @@ public function search($search, $limit, $offset, ISearchResult $searchResult): b
107107
'shareType' => IShare::TYPE_REMOTE,
108108
'shareWith' => $cloudId,
109109
'server' => $serverUrl,
110-
'isTrustedServer' => $this->trustedServers->isTrustedServer($serverUrl),
110+
'isTrustedServer' => $this->trustedServers?->isTrustedServer($serverUrl) ?? false,
111111
],
112112
];
113113
} else {
@@ -120,7 +120,7 @@ public function search($search, $limit, $offset, ISearchResult $searchResult): b
120120
'shareType' => IShare::TYPE_REMOTE,
121121
'shareWith' => $cloudId,
122122
'server' => $serverUrl,
123-
'isTrustedServer' => $this->trustedServers->isTrustedServer($serverUrl),
123+
'isTrustedServer' => $this->trustedServers?->isTrustedServer($serverUrl) ?? false,
124124
],
125125
];
126126
}
@@ -147,7 +147,7 @@ public function search($search, $limit, $offset, ISearchResult $searchResult): b
147147
'shareType' => IShare::TYPE_REMOTE,
148148
'shareWith' => $search,
149149
'server' => $serverUrl,
150-
'isTrustedServer' => $this->trustedServers->isTrustedServer($serverUrl),
150+
'isTrustedServer' => $this->trustedServers?->isTrustedServer($serverUrl) ?? false,
151151
],
152152
];
153153
}

0 commit comments

Comments
 (0)