From 94e73ba716df275b0c008474d34fa8c5fbfe7c52 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=81lvaro=20Brey=20Vilas?= Date: Wed, 1 Dec 2021 16:32:20 +0100 Subject: [PATCH 1/2] UnifiedSearch: Fix opening non-file results with relative URLs MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Most notable in Apps results (Deck, Music...) Signed-off-by: Álvaro Brey Vilas --- .../ui/unifiedsearch/UnifiedSearchViewModel.kt | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/owncloud/android/ui/unifiedsearch/UnifiedSearchViewModel.kt b/src/main/java/com/owncloud/android/ui/unifiedsearch/UnifiedSearchViewModel.kt index 3d396de19a..3dc1453e6f 100644 --- a/src/main/java/com/owncloud/android/ui/unifiedsearch/UnifiedSearchViewModel.kt +++ b/src/main/java/com/owncloud/android/ui/unifiedsearch/UnifiedSearchViewModel.kt @@ -143,12 +143,24 @@ class UnifiedSearchViewModel(application: Application) : AndroidViewModel(applic } } + // TODO test this override fun openResult(result: SearchResultEntry) { if (result.isFile) { openFile(result.remotePath()) } else { - val uri = Uri.parse(result.resourceUrl) - this.browserUri.value = uri + this.browserUri.value = getResultUri(result) + } + } + + private fun getResultUri(result: SearchResultEntry): Uri { + val uri = Uri.parse(result.resourceUrl) + return when (uri.host) { + null -> { + val serverUrl = currentAccountProvider.user.server.uri.toString() + val fullUrl = serverUrl + result.resourceUrl + Uri.parse(fullUrl) + } + else -> uri } } From 8a8c7a098fc2a4d0e2828ef037990584e19c6988 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=81lvaro=20Brey=20Vilas?= Date: Thu, 9 Dec 2021 14:57:33 +0100 Subject: [PATCH 2/2] Remove TODO MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Álvaro Brey Vilas --- .../owncloud/android/ui/unifiedsearch/UnifiedSearchViewModel.kt | 1 - 1 file changed, 1 deletion(-) diff --git a/src/main/java/com/owncloud/android/ui/unifiedsearch/UnifiedSearchViewModel.kt b/src/main/java/com/owncloud/android/ui/unifiedsearch/UnifiedSearchViewModel.kt index 3dc1453e6f..5194a1bba4 100644 --- a/src/main/java/com/owncloud/android/ui/unifiedsearch/UnifiedSearchViewModel.kt +++ b/src/main/java/com/owncloud/android/ui/unifiedsearch/UnifiedSearchViewModel.kt @@ -143,7 +143,6 @@ class UnifiedSearchViewModel(application: Application) : AndroidViewModel(applic } } - // TODO test this override fun openResult(result: SearchResultEntry) { if (result.isFile) { openFile(result.remotePath())