nextcloud / nextcloud/text

"Failed to open file" when opening from search results in iOS app

Open
#7,317 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
JavaScript
Stars
659
Forks
133
Avg merge
1d 20h
Merged PRs (30d)
110

Description

Describe the bug
When searching for a text file in the iOS app, and then trying to open the text file, I receive a "Failed to open file" error message. It does work when I navigate to the file in the folder view and open it from there.

To Reproduce
Steps to reproduce the behavior:

  1. Open the Nextcloud iOS app
  2. Search for a text file
  3. Open it

Expected behavior
The file should be opened from the search result, just like when navigating to it.

Screenshots
Here are 2 screenshots from my phone.
Screenshot 1
Screenshot 2
Note the strange filename in the 2nd screenshot, not sure if this is normal.

Server details:

  • Nextcloud version: 31.0.4
  • PHP Version: 8.3.20
  • Database: PostgreSQL 16.8

Nextcloud is running in a docker container (image nextcloud:apache) behind an nginx reverse proxy.

Client details:

  • OS: iOS
  • Browser: Nextcloud App
  • Browser version: 6.6.4
  • Device: iPhone 14 Pro
Logs
Nextcloud log (data/nextcloud.log)

Here is the log entry of the error. What I find suspicious is that the complete url is appended to the path query param. Is that normal?

{
    "reqId": "phpCCsp3U7gHy7dHEwrU",
    "level": 3,
    "time": "2025-06-19T20:31:23+02:00",
    "remoteAddr": "10.129.255.6",
    "user": "christian",
    "app": "files",
    "method": "POST",
    "url": "/ocs/v2.php/apps/files/api/v1/directEditing/open?path=/https://nextcloud.mydomain.com/remote.php/dav/files/Christian/Kochen/Sushireis.txt&editorId=text",
    "message": "Exception when opening a file through direct editing",
    "userAgent": "Mozilla/5.0 (iOS) Nextcloud-iOS/6.6.4 AppleWebKit/605.1.15 Mobile/15E148",
    "version": "31.0.4.1",
    "exception": {
        "Exception": "OCP\\Files\\NotFoundException",
        "Message": "/christian/files/https:/nextcloud.mydomain.com/remote.php/dav/files/Christian/Kochen/Sushireis.txt",
        "Code": 0,
        "Trace": [
            {
                "file": "/var/www/html/lib/private/Files/Node/LazyFolder.php",
                "line": 138,
                "function": "get",
                "class": "OC\\Files\\Node\\Root",
                "type": "->",
                "args": [
                    "/christian/files/https:/nextcloud.mydomain.com/remote.php/dav/files/Christian/Kochen/Sushireis.txt"
                ]
            },
            {
                "file": "/var/www/html/lib/private/DirectEditing/Manager.php",
                "line": 123,
                "function": "get",
                "class": "OC\\Files\\Node\\LazyFolder",
                "type": "->",
                "args": [
                    "/https://nextcloud.mydomain.com/remote.php/dav/files/Christian/Kochen/Sushireis.txt"
                ]
            },
            {
                "file": "/var/www/html/apps/files/lib/Controller/DirectEditingController.php",
                "line": 106,
                "function": "open",
                "class": "OC\\DirectEditing\\Manager",
                "type": "->",
                "args": [
                    "/https://nextcloud.mydomain.com/remote.php/dav/files/Christian/Kochen/Sushireis.txt",
                    "text",
                    null
                ]
            },
            {
                "file": "/var/www/html/lib/private/AppFramework/Http/Dispatcher.php",
                "line": 200,
                "function": "open",
                "class": "OCA\\Files\\Controller\\DirectEditingController",
                "type": "->",
                "args": [
                    "/https://nextcloud.mydomain.com/remote.php/dav/files/Christian/Kochen/Sushireis.txt",
                    "text",
                    null
                ]
            },
            {
                "file": "/var/www/html/lib/private/AppFramework/Http/Dispatcher.php",
                "line": 114,
                "function": "executeController",
                "class": "OC\\AppFramework\\Http\\Dispatcher",
                "type": "->",
                "args": [
                    {
                        "__class__": "OCA\\Files\\Controller\\DirectEditingController"
                    },
                    "open"
                ]
            },
            {
                "file": "/var/www/html/lib/private/AppFramework/App.php",
                "line": 161,
                "function": "dispatch",
                "class": "OC\\AppFramework\\Http\\Dispatcher",
                "type": "->",
                "args": [
                    {
                        "__class__": "OCA\\Files\\Controller\\DirectEditingController"
                    },
                    "open"
                ]
            },
            {
                "file": "/var/www/html/lib/private/Route/Router.php",
                "line": 307,
                "function": "main",
                "class": "OC\\AppFramework\\App",
                "type": "::",
                "args": [
                    "OCA\\Files\\Controller\\DirectEditingController",
                    "open",
                    {
                        "__class__": "OC\\AppFramework\\DependencyInjection\\DIContainer"
                    },
                    {
                        "_route": "ocs.files.directediting.open"
                    }
                ]
            },
            {
                "file": "/var/www/html/ocs/v1.php",
                "line": 49,
                "function": "match",
                "class": "OC\\Route\\Router",
                "type": "->",
                "args": [
                    "/ocsapp/apps/files/api/v1/directEditing/open"
                ]
            },
            {
                "file": "/var/www/html/ocs/v2.php",
                "line": 7,
                "args": [
                    "/var/www/html/ocs/v1.php"
                ],
                "function": "require_once"
            }
        ],
        "File": "/var/www/html/lib/private/Files/Node/Root.php",
        "Line": 182,
        "message": "Exception when opening a file through direct editing",
        "exception": {},
        "CustomMessage": "Exception when opening a file through direct editing"
    }
}

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 at the directEditing/open endpoint in apps/files/lib/Controller/DirectEditingController.php and follow the calls through lib/private/DirectEditing/Manager.php and lib/private/Files/Node/LazyFolder.php shown in the trace. Reproduce opening a text file from an iOS search result, compare it with folder-view opening, and verify that the search-result file opens successfully without the malformed URL path.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, php
Domain
api, backend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.