nextcloud / nextcloud/ios

Custom unified search file results cannot be opened

Open
#4,274 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Swift
Stars
2.5k
Forks
1k
Avg merge
2d 18h
Merged PRs (30d)
13

Description

Steps to reproduce
  1. Register a custom unified search provider on a Nextcloud server.

  2. Return a SearchResultEntry that refers to a readable file in the user's Nextcloud storage and includes the standard file attributes:

    $entry->addAttribute('fileId', (string)$file->getId());
    $entry->addAttribute('path', $userRelativePath);
    
  3. Search for the entry in Nextcloud iOS.

  4. Tap the result shown under the custom provider.

Expected behaviour

The result is represented as a Nextcloud file and opens in the native viewer, in the same way as a result from the built-in files provider.

Actual behaviour

The result is displayed with a generic URL/file icon, but tapping it has no visible effect. No follow-up network request is made and no error is shown or logged.

The same OCS search response works in the web client and opens natively in the Android client.

Logs

The unified search request completes successfully. Tapping the result produces no subsequent request or log entry.

Reasoning or why should it be changed/implemented?

NKSearchEntry parses the standard fileId and path attributes for every provider. However, NCCollectionViewCommon+Search.swift only resolves them to real file metadata when the provider ID is exactly files. Entries from every other provider are converted to temporary URL metadata with a random ocId.

When the entry is selected, NCCollectionViewCommon+CollectionViewDelegate.swift calls setMetadataSessionInWaitDownloadAsync before opening the URL. The temporary metadata was never stored in Realm, so this method returns nil and the selection handler exits silently.

Custom providers that point to a file already stored in Nextcloud should be allowed to opt into native file handling through fileId/path, independently of their provider ID. URL-only results should retain the existing fallback behaviour.

Environment data

iOS version: 26.6

Nextcloud iOS app version: 34.1.4

Server operating system: Official Nextcloud Docker image

Web server: Apache

Database: SQLite (isolated reproduction instance)

PHP version: 8.4.24

Nextcloud version: 33.0.8

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with NKSearchEntry and NCCollectionViewCommon+Search.swift to trace how fileId and path are converted into metadata, then follow selection in NCCollectionViewCommon+CollectionViewDelegate.swift. Verify that a custom provider result referring to an existing file opens through native file handling, while URL-only results retain their fallback behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
swift
Domain
mobile
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Active
Clarity
Clearly specified
Newbie friendliness
78/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.