From: Joas Schilling Date: Tue, 15 Sep 2020 07:20:10 +0000 (+0200) Subject: Use absolute URLs on search results for the clients X-Git-Tag: v20.0.0RC1~27^2 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=refs%2Fpull%2F22854%2Fhead;p=nextcloud-server.git Use absolute URLs on search results for the clients Signed-off-by: Joas Schilling --- diff --git a/apps/comments/lib/Search/CommentsSearchProvider.php b/apps/comments/lib/Search/CommentsSearchProvider.php index cae4c2f2351..67c297b02ce 100644 --- a/apps/comments/lib/Search/CommentsSearchProvider.php +++ b/apps/comments/lib/Search/CommentsSearchProvider.php @@ -99,13 +99,13 @@ class CommentsSearchProvider implements IProvider { $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'], ]), diff --git a/apps/files/lib/Search/FilesSearchProvider.php b/apps/files/lib/Search/FilesSearchProvider.php index 79ea4aa89f7..e0f421d401d 100644 --- a/apps/files/lib/Search/FilesSearchProvider.php +++ b/apps/files/lib/Search/FilesSearchProvider.php @@ -97,14 +97,14 @@ class FilesSearchProvider implements IProvider { 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()))