Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: Direct downloads misbehaving after upgrade to 31.0.2 #51711

Open
5 of 8 tasks
avonder opened this issue Mar 25, 2025 · 1 comment
Open
5 of 8 tasks

[Bug]: Direct downloads misbehaving after upgrade to 31.0.2 #51711

avonder opened this issue Mar 25, 2025 · 1 comment
Labels
0. Needs triage Pending check for reproducibility or if it fits our roadmap 31-feedback bug high

Comments

@avonder
Copy link

avonder commented Mar 25, 2025

⚠️ This issue respects the following points: ⚠️

Bug description

Direct links to files in a shared folder have changed format, and the old one (/s/sharelink/download?path=%2Ffolder&files=file) no longer works.

"GET /s/sharelink/download?path=%2Ffolder&files=file HTTP/1.1" 500 2950

{
    "level": 3,
    "user": false,
    "app": "index",
    "method": "GET",
    "url": "/s/sharelink/download?path=%2Ffolder&files=file",
    "message": "OC\\Files\\Utils\\PathHelper::normalizePath(): Argument #1 ($path) must be of type string, null given, called in /usr/share/webapps/nextcloud/lib/private/Files/Node/Node.php on line 321 in file '/usr/share/webapps/nextcloud/lib/private/Files/Utils/PathHelper.php' line 36",
    "userAgent": "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/134.0.0.0 Safari/537.36",
    "version": "31.0.2.1",
    "exception":
    {
        "Exception": "Exception",
        "Message": "OC\\Files\\Utils\\PathHelper::normalizePath(): Argument #1 ($path) must be of type string, null given, called in /usr/share/webapps/nextcloud/lib/private/Files/Node/Node.php on line 321 in file '/usr/share/webapps/nextcloud/lib/private/Files/Utils/PathHelper.php' line 36",
        "Code": 0,
        "Trace":
        [
            {
                "file": "/usr/share/webapps/nextcloud/lib/private/AppFramework/App.php",
                "line": 161,
                "function": "dispatch",
                "class": "OC\\AppFramework\\Http\\Dispatcher",
                "type": "->"
            },
            {
                "file": "/usr/share/webapps/nextcloud/lib/private/Route/Router.php",
                "line": 307,
                "function": "main",
                "class": "OC\\AppFramework\\App",
                "type": "::"
            },
            {
                "file": "/usr/share/webapps/nextcloud/lib/base.php",
                "line": 1025,
                "function": "match",
                "class": "OC\\Route\\Router",
                "type": "->"
            },
            {
                "file": "/usr/share/webapps/nextcloud/index.php",
                "line": 24,
                "function": "handleRequest",
                "class": "OC",
                "type": "::"
            }
        ],
        "File": "/usr/share/webapps/nextcloud/lib/private/AppFramework/Http/Dispatcher.php",
        "Line": 146,
        "Previous":
        {
            "Exception": "TypeError",
            "Message": "OC\\Files\\Utils\\PathHelper::normalizePath(): Argument #1 ($path) must be of type string, null given, called in /usr/share/webapps/nextcloud/lib/private/Files/Node/Node.php on line 321",
            "Code": 0,
            "Trace":
            [
                {
                    "file": "/usr/share/webapps/nextcloud/lib/private/Files/Node/Node.php",
                    "line": 321,
                    "function": "normalizePath",
                    "class": "OC\\Files\\Utils\\PathHelper",
                    "type": "::"
                },
                {
                    "file": "/usr/share/webapps/nextcloud/lib/private/Files/Node/Folder.php",
                    "line": 49,
                    "function": "normalizePath",
                    "class": "OC\\Files\\Node\\Node",
                    "type": "->"
                },
                {
                    "file": "/usr/share/webapps/nextcloud/lib/private/Files/Node/Folder.php",
                    "line": 107,
                    "function": "getFullPath",
                    "class": "OC\\Files\\Node\\Folder",
                    "type": "->"
                },
                {
                    "file": "/usr/share/webapps/nextcloud/apps/files_sharing/lib/Controller/ShareController.php",
                    "line": 403,
                    "function": "get",
                    "class": "OC\\Files\\Node\\Folder",
                    "type": "->"
                },
                {
                    "file": "/usr/share/webapps/nextcloud/lib/private/AppFramework/Http/Dispatcher.php",
                    "line": 200,
                    "function": "downloadShare",
                    "class": "OCA\\Files_Sharing\\Controller\\ShareController",
                    "type": "->"
                },
                {
                    "file": "/usr/share/webapps/nextcloud/lib/private/AppFramework/Http/Dispatcher.php",
                    "line": 114,
                    "function": "executeController",
                    "class": "OC\\AppFramework\\Http\\Dispatcher",
                    "type": "->"
                },
                {
                    "file": "/usr/share/webapps/nextcloud/lib/private/AppFramework/App.php",
                    "line": 161,
                    "function": "dispatch",
                    "class": "OC\\AppFramework\\Http\\Dispatcher",
                    "type": "->"
                },
                {
                    "file": "/usr/share/webapps/nextcloud/lib/private/Route/Router.php",
                    "line": 307,
                    "function": "main",
                    "class": "OC\\AppFramework\\App",
                    "type": "::"
                },
                {
                    "file": "/usr/share/webapps/nextcloud/lib/base.php",
                    "line": 1025,
                    "function": "match",
                    "class": "OC\\Route\\Router",
                    "type": "->"
                },
                {
                    "file": "/usr/share/webapps/nextcloud/index.php",
                    "line": 24,
                    "function": "handleRequest",
                    "class": "OC",
                    "type": "::"
                }
            ],
            "File": "/usr/share/webapps/nextcloud/lib/private/Files/Utils/PathHelper.php",
            "Line": 36
        },
        "message": "OC\\Files\\Utils\\PathHelper::normalizePath(): Argument #1 ($path) must be of type string, null given, called in /usr/share/webapps/nextcloud/lib/private/Files/Node/Node.php on line 321 in file '/usr/share/webapps/nextcloud/lib/private/Files/Utils/PathHelper.php' line 36",
        "exception":
        {},
        "CustomMessage": "OC\\Files\\Utils\\PathHelper::normalizePath(): Argument #1 ($path) must be of type string, null given, called in /usr/share/webapps/nextcloud/lib/private/Files/Node/Node.php on line 321 in file '/usr/share/webapps/nextcloud/lib/private/Files/Utils/PathHelper.php' line 36"
    }
}

That is fine, but the new one (/public.php/dav/files/sharelink/folder/file), although succeeding, generates an error in the log and a duplicate download notice in the activity log.

"HEAD /public.php/dav/files/sharelink/folder/file HTTP/1.1" 500 -
"GET /public.php/dav/files/sharelink/folder/file HTTP/1.1" 200 16544210

{
    "level": 3,
    "user": false,
    "app": "webdav",
    "method": "HEAD",
    "url": "/public.php/dav/files/sharelink/folder/file",
    "message": "stream_get_meta_data(): Argument #1 ($stream) must be of type resource, string given",
    "userAgent": "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/134.0.0.0 Safari/537.36",
    "version": "31.0.2.1",
    "exception":
    {
        "Exception": "TypeError",
        "Message": "stream_get_meta_data(): Argument #1 ($stream) must be of type resource, string given",
        "Code": 0,
        "Trace":
        [
            {
                "file": "/usr/share/webapps/nextcloud/3rdparty/sabre/dav/lib/DAV/CorePlugin.php",
                "line": 179,
                "function": "stream_get_meta_data"
            },
            {
                "file": "/usr/share/webapps/nextcloud/3rdparty/sabre/event/lib/WildcardEmitterTrait.php",
                "line": 89,
                "function": "httpGet",
                "class": "Sabre\\DAV\\CorePlugin",
                "type": "->"
            },
            {
                "file": "/usr/share/webapps/nextcloud/3rdparty/sabre/dav/lib/DAV/Server.php",
                "line": 472,
                "function": "emit",
                "class": "Sabre\\DAV\\Server",
                "type": "->"
            },
            {
                "file": "/usr/share/webapps/nextcloud/3rdparty/sabre/dav/lib/DAV/CorePlugin.php",
                "line": 251,
                "function": "invokeMethod",
                "class": "Sabre\\DAV\\Server",
                "type": "->"
            },
            {
                "file": "/usr/share/webapps/nextcloud/3rdparty/sabre/event/lib/WildcardEmitterTrait.php",
                "line": 89,
                "function": "httpHead",
                "class": "Sabre\\DAV\\CorePlugin",
                "type": "->"
            },
            {
                "file": "/usr/share/webapps/nextcloud/3rdparty/sabre/dav/lib/DAV/Server.php",
                "line": 472,
                "function": "emit",
                "class": "Sabre\\DAV\\Server",
                "type": "->"
            },
            {
                "file": "/usr/share/webapps/nextcloud/apps/dav/lib/Connector/Sabre/Server.php",
                "line": 49,
                "function": "invokeMethod",
                "class": "Sabre\\DAV\\Server",
                "type": "->"
            },
            {
                "file": "/usr/share/webapps/nextcloud/apps/dav/appinfo/v2/publicremote.php",
                "line": 151,
                "function": "start",
                "class": "OCA\\DAV\\Connector\\Sabre\\Server",
                "type": "->"
            },
            {
                "file": "/usr/share/webapps/nextcloud/public.php",
                "line": 82,
                "args":
                [
                    "/usr/share/webapps/nextcloud/apps/dav/appinfo/v2/publicremote.php"
                ],
                "function": "require_once"
            }
        ],
        "File": "/usr/share/webapps/nextcloud/3rdparty/sabre/dav/lib/DAV/CorePlugin.php",
        "Line": 179,
        "message": "stream_get_meta_data(): Argument #1 ($stream) must be of type resource, string given",
        "exception":
        {},
        "CustomMessage": "stream_get_meta_data(): Argument #1 ($stream) must be of type resource, string given"
    }
}

That is fine too, but both it and the whole-share download (/s/sharelink/download) are now not working if accessed via a link from another website.

"GET /public.php/dav/files/sharelink/folder/file HTTP/1.1" 412 55
"GET /s/sharelink/download HTTP/1.1" 303 -
"GET /public.php/dav/files/sharelink/?accept=zip HTTP/1.1" 412 55

{
    "level": 2,
    "user": "admin",
    "app": "no app in context",
    "method": "GET",
    "url": "/public.php/dav/files/sharelink/?accept=zip",
    "message": "Request does not pass strict cookie check",
    "userAgent": "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/134.0.0.0 Safari/537.36",
    "version": "31.0.2.1",
    "data":
    []
}

Steps to reproduce

Create a shared folder, visit it and then try direct downloading via a link as described above.

Expected behavior

Error-free downloads.

Nextcloud Server version

31

Operating system

Other

PHP engine version

PHP 8.2

Web server

Apache (supported)

Database engine version

PostgreSQL

Is this bug present after an update or on a fresh install?

Updated from a MINOR version (ex. 32.0.1 to 32.0.2)

Are you using the Nextcloud Server Encryption module?

None

What user-backends are you using?

  • Default user-backend (database)
  • LDAP/ Active Directory
  • SSO - SAML
  • Other

Configuration report

{
    "system": {
        "datadirectory": "***REMOVED SENSITIVE VALUE***",
        "logfile": "\/var\/log\/nextcloud\/nextcloud.log",
        "apps_paths": [
            {
                "path": "\/usr\/share\/webapps\/nextcloud\/apps",
                "url": "\/apps",
                "writable": false
            },
            {
                "path": "\/var\/lib\/nextcloud\/apps",
                "url": "\/wapps",
                "writable": true
            }
        ],
        "trusted_domains": [
            "localhost",
            "***REMOVED SENSITIVE VALUE***"
        ],
        "default_language": "en",
        "overwrite.cli.url": "***REMOVED SENSITIVE VALUE***",
        "htaccess.RewriteBase": "\/",
        "passwordsalt": "***REMOVED SENSITIVE VALUE***",
        "secret": "***REMOVED SENSITIVE VALUE***",
        "dbtype": "pgsql",
        "version": "31.0.2.1",
        "dbname": "***REMOVED SENSITIVE VALUE***",
        "dbhost": "***REMOVED SENSITIVE VALUE***",
        "dbport": "",
        "dbtableprefix": "oc_",
        "dbuser": "***REMOVED SENSITIVE VALUE***",
        "dbpassword": "***REMOVED SENSITIVE VALUE***",
        "installed": true,
        "instanceid": "***REMOVED SENSITIVE VALUE***",
        "memcache.local": "\\OC\\Memcache\\APCu",
        "memcache.distributed": "\\OC\\Memcache\\Redis",
        "memcache.locking": "\\OC\\Memcache\\Redis",
        "redis": {
            "host": "***REMOVED SENSITIVE VALUE***",
            "port": 0,
            "timeout": 0
        },
        "loglevel": 2,
        "maintenance": false,
        "theme": "",
        "app_install_overwrite": [
            "sharingpath",
            "files_readmemd"
        ]
    }
}

List of activated Apps

Enabled:
  - activity: 4.0.0
  - app_api: 5.0.2
  - bruteforcesettings: 4.0.0
  - circles: 31.0.0
  - cloud_federation_api: 1.14.0
  - comments: 1.21.0
  - contactsinteraction: 1.12.0
  - dashboard: 7.11.0
  - dav: 1.33.0
  - federatedfilesharing: 1.21.0
  - federation: 1.21.0
  - files: 2.3.1
  - files_downloadlimit: 4.0.0
  - files_pdfviewer: 4.0.0
  - files_reminders: 1.4.0
  - files_sharing: 1.23.1
  - files_trashbin: 1.21.0
  - files_versions: 1.24.0
  - firstrunwizard: 4.0.0
  - logreader: 4.0.0
  - lookup_server_connector: 1.19.0
  - nextcloud_announcements: 3.0.0
  - notifications: 4.0.0
  - oauth2: 1.19.1
  - password_policy: 3.0.0
  - photos: 4.0.0-dev.1
  - privacy: 3.0.0
  - profile: 1.0.0
  - provisioning_api: 1.21.0
  - recommendations: 4.0.0
  - related_resources: 2.0.0
  - serverinfo: 3.0.0
  - settings: 1.14.0
  - sharebymail: 1.21.0
  - support: 3.0.0
  - survey_client: 3.0.0
  - systemtags: 1.21.1
  - text: 5.0.0
  - theming: 2.6.1
  - theming_customcss: 1.18.0
  - twofactor_backupcodes: 1.20.0
  - updatenotification: 1.21.0
  - user_status: 1.11.0
  - viewer: 4.0.0
  - weather_status: 1.11.0
  - webhook_listeners: 1.2.0
  - workflowengine: 2.13.0
Disabled:
  - admin_audit: 1.21.0
  - encryption: 2.19.0
  - files_external: 1.23.0
  - files_readmemd: 3.0.2 (installed 3.0.2)
  - suspicious_login: 9.0.1
  - twofactor_nextcloud_notification: 5.0.0
  - twofactor_totp: 13.0.0-dev.0
  - user_ldap: 1.22.0

Nextcloud Signing status

No errors have been found.

Nextcloud Logs

Additional info

No response

@avonder avonder added 0. Needs triage Pending check for reproducibility or if it fits our roadmap bug labels Mar 25, 2025
@renebentes
Copy link

I'm getting the same error here when using wget to download a file in https://server/s/share-id/download?path=folder&files=filename.ext.

I upgraded from 30.0.8 to 31.0.2.

Thank you all!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
0. Needs triage Pending check for reproducibility or if it fits our roadmap 31-feedback bug high
Projects
None yet
Development

No branches or pull requests

3 participants