Skip to content

Commit f9633a1

Browse files
committed
fix(globalscale): ignore lookupserver if empty config
Signed-off-by: Maxence Lange <maxence@artificial-owl.com>
1 parent b941ad8 commit f9633a1

2 files changed

Lines changed: 7 additions & 1 deletion

File tree

‎lib/private/Collaboration/Collaborators/Search.php‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
use OCP\Collaboration\Collaborators\ISearchResult;
1414
use OCP\Collaboration\Collaborators\SearchResultType;
1515
use OCP\EventDispatcher\IEventDispatcher;
16+
use OCP\IConfig;
1617
use OCP\IContainer;
1718
use OCP\Share\IShare;
1819

@@ -23,6 +24,7 @@ class Search implements ISearch {
2324
public function __construct(
2425
private readonly IContainer $container,
2526
private readonly IEventDispatcher $eventDispatcher,
27+
private readonly IConfig $config,
2628
) {
2729
}
2830

@@ -42,6 +44,9 @@ public function filteredSearch(string $search, array $shareTypes, bool $lookup,
4244
/** @var ISearchResult $searchResult */
4345
$searchResult = $this->container->resolve(SearchResult::class);
4446

47+
// confirm lookup server is not empty
48+
$lookup = $lookup && !empty($this->config->getSystemValueString('lookup_server', 'https://lookup.nextcloud.com'));
49+
4550
foreach ($shareTypes as $type) {
4651
if (!isset($this->pluginList[$type])) {
4752
continue;

‎tests/lib/Collaboration/Collaborators/SearchResultTest.php‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
use OCP\Collaboration\Collaborators\ISearch;
1313
use OCP\Collaboration\Collaborators\SearchResultType;
1414
use OCP\EventDispatcher\IEventDispatcher;
15+
use OCP\IConfig;
1516
use OCP\IContainer;
1617
use Test\TestCase;
1718

@@ -27,7 +28,7 @@ protected function setUp(): void {
2728

2829
$this->container = $this->createMock(IContainer::class);
2930

30-
$this->search = new Search($this->container, $this->createMock(IEventDispatcher::class));
31+
$this->search = new Search($this->container, $this->createMock(IEventDispatcher::class), $this->createMock(IConfig::class));
3132
}
3233

3334
public static function dataAddResultSet(): array {

0 commit comments

Comments
 (0)