Skip to content

Commit

Permalink
Merge pull request #22854 from nextcloud/bugfix/noid/unified-search
Browse files Browse the repository at this point in the history
Bugfix/noid/unified search
  • Loading branch information
rullzer committed Sep 15, 2020
2 parents 74e0b50 + d37bd2c commit 2dbeb58
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 8 deletions.
6 changes: 3 additions & 3 deletions apps/comments/lib/Search/CommentsSearchProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -99,13 +99,13 @@ public function search(IUser $user, ISearchQuery $query): SearchResult {
$pathInfo = pathinfo($path);
$isUser = $this->userManager->userExists($result->authorId);
$avatarUrl = $isUser
? $this->urlGenerator->linkToRoute('core.avatar.getAvatar', ['userId' => $result->authorId, 'size' => 42])
: $this->urlGenerator->linkToRoute('core.GuestAvatar.getAvatar', ['guestName' => $result->authorId, 'size' => 42]);
? $this->urlGenerator->linkToRouteAbsolute('core.avatar.getAvatar', ['userId' => $result->authorId, 'size' => 42])
: $this->urlGenerator->linkToRouteAbsolute('core.GuestAvatar.getAvatar', ['guestName' => $result->authorId, 'size' => 42]);
return new SearchResultEntry(
$avatarUrl,
$result->name,
$path,
$this->urlGenerator->linkToRoute('files.view.index',[
$this->urlGenerator->linkToRouteAbsolute('files.view.index',[
'dir' => $pathInfo['dirname'],
'scrollto' => $pathInfo['basename'],
]),
Expand Down
4 changes: 2 additions & 2 deletions apps/files/lib/Search/FilesSearchProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -107,14 +107,14 @@ public function search(IUser $user, ISearchQuery $query): SearchResult {
array_map(function (FileResult $result) {
// Generate thumbnail url
$thumbnailUrl = $result->has_preview
? $this->urlGenerator->linkToRoute('core.Preview.getPreviewByFileId', ['x' => 32, 'y' => 32, 'fileId' => $result->id])
? $this->urlGenerator->linkToRouteAbsolute('core.Preview.getPreviewByFileId', ['x' => 32, 'y' => 32, 'fileId' => $result->id])
: '';

return new SearchResultEntry(
$thumbnailUrl,
$result->name,
$this->formatSubline($result),
$result->link,
$this->urlGenerator->getAbsoluteURL($result->link),
$result->type === 'folder' ? 'icon-folder' : $this->mimeTypeDetector->mimeTypeIcon($result->mime_type)
);
}, $this->fileSearch->search($query->getTerm()))
Expand Down
7 changes: 4 additions & 3 deletions core/Controller/UnifiedSearchController.php
Original file line number Diff line number Diff line change
Expand Up @@ -72,9 +72,10 @@ public function __construct(IRequest $request,
public function getProviders(string $from = ''): DataResponse {
[$route, $parameters] = $this->getRouteInformation($from);

return new DataResponse(
$this->composer->getProviders($route, $parameters)
);
$result = $this->composer->getProviders($route, $parameters);
$response = new DataResponse($result);
$response->setETag(md5(json_encode($result)));
return $response;
}

/**
Expand Down

0 comments on commit 2dbeb58

Please sign in to comment.