Skip to content

Custom unified search file results cannot be opened #4274

Description

@Dennis-Otto

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions