mirror of
https://github.com/nextcloud/android.git
synced 2024-11-25 06:35:48 +03:00
Merge pull request #9426 from nextcloud/fix/unified-search-apps
UnifiedSearch: Fix opening non-file results with relative URLs
This commit is contained in:
commit
0edba984be
1 changed files with 13 additions and 2 deletions
|
@ -147,8 +147,19 @@ class UnifiedSearchViewModel(application: Application) : AndroidViewModel(applic
|
|||
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
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue