nextcloud / nextcloud/android

Full text search results open in browser

Open
#15,233 0 comments 0 reactions 0 assignees View on GitHub
0. Needs triage bug
Dominant language
Kotlin
Stars
5.6k
Forks
2k
Avg merge
2d 18h
Merged PRs (30d)
92

Description

### ⚠️ Before posting ⚠️

- [x] This is a **bug**, not a question or an enhancement.
- [x] I've [searched for similar issues](https://github.com/nextcloud/android/issues) and didn't find a duplicate.
- [x] I've written a clear and descriptive title for this issue, not just "Bug" or "Crash".
- [x] I agree to follow Nextcloud's [Code of Conduct](https://nextcloud.com/contribute/code-of-conduct/).

### Steps to reproduce

1. Enable fulltextsearch and fulltextsearch_files apps on server instance
2. Enable option "Open files - directly from search results" in "Full text search" instance admin settings
3. Search for something in the Android app
4. Open a file from the full text search results

### Expected behaviour

The file opens inside the Android app (like it does when the option from 2. is disabled)

### Actual behaviour

The browser opens with a link to the file

### Android version

16

### Device brand and model

irrelevant

### Stock or custom OS?

Custom (explain in "additional information")

### Nextcloud android app version

3.32.0

### Nextcloud server version

31.0.7

### Using a reverse proxy?

Yes

### Android logs

_No response_

### Server error logs

```bash

```

### Additional information

Commit nextcloud/android-library@9d8f309 introduced correct handling of the URLs that are returned when the files_open_result_directly option (which probably didn't event exist back then?) is disabled. They are of the form `https://cloud.example.org/apps/files/?dir=/foo&scrollto=filename.txt`

When the option is enabled, however, the URL returned by the server is `https://cloud.example.org/f/1234567`.

I think an implementation could roughly work like this:
1. [`SearchResultEntry.isFile()` in nextcloud/android-library](https://github.com/nextcloud/android-library/blob/5b035868b20f8379ee424c2b14c50bebd9ff8392/library/src/main/java/com/owncloud/android/lib/common/SearchResultEntry.kt#L31-L32) would need to recognize this format and report it to be a file
2. [`UnifiedSearchViewModel.openFile()`](https://github.com/nextcloud/android/blob/9f1793ac43602d73e54ab3f06accd534994e718d/app/src/main/java/com/owncloud/android/ui/unifiedsearch/UnifiedSearchViewModel.kt#L159-L172) would need to be able to work with a file ID instead of path and filename
3. [`SearchResultEntry.fileId()` in nextcloud/nadroid-library](https://github.com/nextcloud/android-library/blob/5b035868b20f8379ee424c2b14c50bebd9ff8392/library/src/main/java/com/owncloud/android/lib/common/SearchResultEntry.kt#L34) would need a fallback function just like `remotePath()` to parse the file ID from the URL

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.