Skip to content

404 When Reading file names with special chars via WebDAV #32009

Closed

Description

@TheAkki

Steps to reproduce

  1. Create a folder with special chars like 'C++', 'Bücher', 'Name with spaces'
  2. Call ReadRemoteFileOperation (https://github.com/owncloud/android-library/blob/master/src/com/owncloud/android/lib/resources/files/ReadRemoteFileOperation.java)

Expected behaviour

Status is range of 200

Actual behaviour

Status is 404

Server configuration

Operating system:
Linux, Synology NAS with DiskStation

Web server:
Apache 2.4.29

Database:
MariaDB

PHP version:
7

ownCloud version: (see ownCloud admin page)
10.0.8.5

Updated from an older ownCloud or fresh install:
updated

Where did you install ownCloud from:
Synology package

Signing status (ownCloud 9.0 and above):

- INVALID_HASH
	- updater/vendor/autoload.php
	- updater/vendor/composer/autoload_real.php
	- updater/vendor/composer/autoload_static.php
- EXTRA_FILE
	- backupDatabase/export.sql

The content of config/config.php:

    "config": {
        "instanceid": "ocd258725817",
        "passwordsalt": "***REMOVED SENSITIVE VALUE***",
        "trusted_domains": [
            "192.168.178.42"
        ],
        "datadirectory": "\/volume1\/web\/owncloud\/data",
        "dbtype": "mysql",
        "version": "10.0.8.5",
        "dbname": "Owncloud",
        "dbhost": "127.0.0.1",
        "dbtableprefix": "oc_",
        "dbuser": "***REMOVED SENSITIVE VALUE***",
        "dbpassword": "***REMOVED SENSITIVE VALUE***",
        "installed": true,
        "theme": "",
        "maintenance": false,
        "secret": "***REMOVED SENSITIVE VALUE***",
        "loglevel": 4,
        "trashbin_retention_obligation": "auto",
        "updater.secret": "***REMOVED SENSITIVE VALUE***"
    }
"core": {
    "backgroundjobs_mode": "cron",
    "global_cache_gc_lastrun": "1493644222",
    "installedat": "1398980979.5534",
    "lastcron": "1529163558",
    "lastupdateResult": "[]",
    "lastupdatedat": "1531073095",
    "public_caldav": "calendar\/share.php",
    "public_calendar": "calendar\/share.php",
    "public_documents": "documents\/public.php",
    "public_files": "files_sharing\/public.php",
    "public_gallery": "gallery\/public.php",
    "public_webdav": "dav\/appinfo\/v1\/publicwebdav.php",
    "remote_caldav": "dav\/appinfo\/v1\/caldav.php",
    "remote_calendar": "dav\/appinfo\/v1\/caldav.php",
    "remote_carddav": "dav\/appinfo\/v1\/carddav.php",
    "remote_contacts": "dav\/appinfo\/v1\/carddav.php",
    "remote_core.css": "\/core\/minimizer.php",
    "remote_core.js": "\/core\/minimizer.php",
    "remote_dav": "dav\/appinfo\/v2\/remote.php",
    "remote_files": "dav\/appinfo\/v1\/webdav.php",
    "remote_filesync": "files\/appinfo\/filesync.php",
    "remote_mozilla_sync": "mozilla_sync\/appinfo\/remote.php",
    "remote_webdav": "dav\/appinfo\/v1\/webdav.php",
    "repairlegacystoragesdone": "yes",
    "updater.secret.created": "1529158835",
    "vendor": "owncloud"
}

Are you using external storage, if yes which one: local/smb/sftp/...
no

Are you using encryption:
no

Are you using an external user-backend, if yes which one: LDAP/ActiveDirectory/Webdav/...
WebDAV

Client configuration

Operating system:
Android

Logs

Web server error log

ownCloud log (data/owncloud.log)

{"reqId":"oAVbNcZ8oyzBrgrf8c28","level":0,"time":"2018-07-08T17:35:07+00:00","remoteAddr":"192.168.178.32","user":"OwnCloudConnection","app":"webdav","method":"PROPFIND","url":"\/owncloud\/remote.php\/webdav\/Documents\/C%252b%252b\/","message":"Exception: {\"Message\":\"HTTP\\\/1.1 404 File with name Documents\\\/C%2b%2b could not be located\",\"Exception\":\"Sabre\\\\DAV\\\\Exception\\\\NotFound\",\"Code\":0,\"Trace\":\"#0 \\\/volume1\\\/web\\\/owncloud\\\/lib\\\/composer\\\/sabre\\\/dav\\\/lib\\\/DAV\\\/Server.php(966): OCA\\\\DAV\\\\Connector\\\\Sabre\\\\ObjectTree->getNodeForPath('Documents\\\/C%2b%...')\\n#1 \\\/volume1\\\/web\\\/owncloud\\\/lib\\\/composer\\\/sabre\\\/dav\\\/lib\\\/DAV\\\/Server.php(1665): Sabre\\\\DAV\\\\Server->getPropertiesIteratorForPath('Documents\\\/C%2b%...', Array, 1)\\n#2 \\\/volume1\\\/web\\\/owncloud\\\/lib\\\/composer\\\/sabre\\\/dav\\\/lib\\\/DAV\\\/CorePlugin.php(355): Sabre\\\\DAV\\\\Server->generateMultiStatus(Object(Generator), false)\\n#3 [internal function]: Sabre\\\\DAV\\\\CorePlugin->httpPropFind(Object(Sabre\\\\HTTP\\\\Request), Object(Sabre\\\\HTTP\\\\Response))\\n#4 \\\/volume1\\\/web\\\/owncloud\\\/lib\\\/composer\\\/sabre\\\/event\\\/lib\\\/EventEmitterTrait.php(105): call_user_func_array(Array, Array)\\n#5 \\\/volume1\\\/web\\\/owncloud\\\/lib\\\/composer\\\/sabre\\\/dav\\\/lib\\\/DAV\\\/Server.php(479): Sabre\\\\Event\\\\EventEmitter->emit('method:PROPFIND', Array)\\n#6 \\\/volume1\\\/web\\\/owncloud\\\/lib\\\/composer\\\/sabre\\\/dav\\\/lib\\\/DAV\\\/Server.php(254): Sabre\\\\DAV\\\\Server->invokeMethod(Object(Sabre\\\\HTTP\\\\Request), Object(Sabre\\\\HTTP\\\\Response))\\n#7 \\\/volume1\\\/web\\\/owncloud\\\/apps\\\/dav\\\/appinfo\\\/v1\\\/webdav.php(63): Sabre\\\\DAV\\\\Server->exec()\\n#8 \\\/volume1\\\/web\\\/owncloud\\\/remote.php(165): require_once('\\\/volume1\\\/web\\\/ow...')\\n#9 {main}\",\"File\":\"\\\/volume1\\\/web\\\/owncloud\\\/apps\\\/dav\\\/lib\\\/Connector\\\/Sabre\\\/ObjectTree.php\",\"Line\":193,\"User\":\"OwnCloudConnection\"}"}

{"reqId":"zBKp0UkuE53GXMMELF15","level":0,"time":"2018-07-06T18:25:39+00:00","remoteAddr":"192.168.178.32","user":"TheAkki","app":"webdav","method":"PROPFIND","url":"\/owncloud\/remote.php\/webdav\/","message":"Exception: {\"Message\":\"HTTP\\\/1.1 404 Not Found\",\"Exception\":\"Sabre\\\\DAV\\\\Exception\\\\NotFound\",\"Code\":0,\"Trace\":\"#0 [internal function]: OCA\\\\DAV\\\\Connector\\\\Sabre\\\\FilesPlugin->handleGetProperties(Object(Sabre\\\\DAV\\\\PropFind), Object(OCA\\\\DAV\\\\Connector\\\\Sabre\\\\File))\\n#1 \\\/volume1\\\/web\\\/owncloud\\\/lib\\\/composer\\\/sabre\\\/event\\\/lib\\\/EventEmitterTrait.php(105): call_user_func_array(Array, Array)\\n#2 \\\/volume1\\\/web\\\/owncloud\\\/lib\\\/composer\\\/sabre\\\/dav\\\/lib\\\/DAV\\\/Server.php(1058): Sabre\\\\Event\\\\EventEmitter->emit('propFind', Array)\\n#3 \\\/volume1\\\/web\\\/owncloud\\\/lib\\\/composer\\\/sabre\\\/dav\\\/lib\\\/DAV\\\/Server.php(980): Sabre\\\\DAV\\\\Server->getPropertiesByNode(Object(Sabre\\\\DAV\\\\PropFind), Object(OCA\\\\DAV\\\\Connector\\\\Sabre\\\\File))\\n#4 \\\/volume1\\\/web\\\/owncloud\\\/lib\\\/composer\\\/sabre\\\/dav\\\/lib\\\/DAV\\\/Server.php(1665): Sabre\\\\DAV\\\\Server->getPropertiesIteratorForPath('', Array, -1)\\n#5 \\\/volume1\\\/web\\\/owncloud\\\/lib\\\/composer\\\/sabre\\\/dav\\\/lib\\\/DAV\\\/CorePlugin.php(355): Sabre\\\\DAV\\\\Server->generateMultiStatus(Object(Generator), false)\\n#6 [internal function]: Sabre\\\\DAV\\\\CorePlugin->httpPropFind(Object(Sabre\\\\HTTP\\\\Request), Object(Sabre\\\\HTTP\\\\Response))\\n#7 \\\/volume1\\\/web\\\/owncloud\\\/lib\\\/composer\\\/sabre\\\/event\\\/lib\\\/EventEmitterTrait.php(105): call_user_func_array(Array, Array)\\n#8 \\\/volume1\\\/web\\\/owncloud\\\/lib\\\/composer\\\/sabre\\\/dav\\\/lib\\\/DAV\\\/Server.php(479): Sabre\\\\Event\\\\EventEmitter->emit('method:PROPFIND', Array)\\n#9 \\\/volume1\\\/web\\\/owncloud\\\/lib\\\/composer\\\/sabre\\\/dav\\\/lib\\\/DAV\\\/Server.php(254): Sabre\\\\DAV\\\\Server->invokeMethod(Object(Sabre\\\\HTTP\\\\Request), Object(Sabre\\\\HTTP\\\\Response))\\n#10 \\\/volume1\\\/web\\\/owncloud\\\/apps\\\/dav\\\/appinfo\\\/v1\\\/webdav.php(63): Sabre\\\\DAV\\\\Server->exec()\\n#11 \\\/volume1\\\/web\\\/owncloud\\\/remote.php(165): require_once('\\\/volume1\\\/web\\\/ow...')\\n#12 {main}\",\"File\":\"\\\/volume1\\\/web\\\/owncloud\\\/apps\\\/dav\\\/lib\\\/Connector\\\/Sabre\\\/FilesPlugin.php\",\"Line\":274,\"User\":\"TheAkki\"}"}

Also find more information: https://central.owncloud.org/t/404-exception-bei-propfind-bei-ordnern-mit-sonderzeichen/14396

Greetz
TheAkki

Activity

  1. ownclouders commented on Jul 8, 2018

    @ownclouders
    Contributor

    GitMate.io thinks the contributor most likely able to help you is @ghost.

    Possibly related issues are #5735 (Special chars), #4370 (webdav via gvfs), #1783 ((file / folder) names starting with an accentued char), #579 (The creation of folders with special chars on their name always end up in folder duplication), and #31238 (Wrong fileid when requesting files list via webdav with Depth: infinity).

  2. phil-davis commented on Jul 9, 2018

    @phil-davis
    Contributor

    I added some API acceptance tests in PR #32010
    They all pass, so I wonder what the problem is here?
    Ran the tests against 10.0.8.5 and they also pass there.

  3. phil-davis commented on Jul 9, 2018

    @phil-davis
    Contributor

    The PROPFIND goes to:

    "url":"\/owncloud\/remote.php\/webdav\/Documents\/C%252b%252b\/"
    

    That looks like too much escaping is happening. The + sign has been escaped to %2b - good. But then the % sign has been escaped to %25. So the server ends up thinking that the requested file name is literally C%2b%2b rather than C++

    Is this an issue somewhere in the underlying Android code that is doing the escaping?

  4. TheAkki commented on Jul 9, 2018

    @TheAkki
    Author

    I don't thinks that it's only the android code.
    You see in the second error message the url "url":"\/owncloud\/remote.php\/webdav\/" to the base. So you don't need the android lib. Right?

  5. phil-davis commented on Jul 9, 2018

    @phil-davis
    Contributor

    The app code (I think) is doing the escaping to generate C%252b%252b as the escaped folder name. If the app implements over-exuberant escaping, then the server is going to interpret it different.
    I think the folder name should be escaped as just C%2b%2b

  6. TheAkki commented on Jul 9, 2018

    @TheAkki
    Author

    I think we have two problems.
    1.) Android Library do not escape correctly. (C++ Folder)
    2.) Something goes wrong in the server (Root Folder)
    You see different call stacks.

    There is also a different. The first is only with deep = 1, the second has a deep = infinity.

  7. TheAkki commented on Jul 12, 2018

    @TheAkki
    Author

    What says the test. Are any problems?
    Is there a test which get all items where are special chars in name?

  8. TheAkki commented on Aug 22, 2018

    @TheAkki
    Author

    When i set the deep to 1 it works.
    In other cases i tried infinity.

  9. stale commented on Sep 20, 2021

    @stale

    This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 10 days if no further activity occurs. Thank you for your contributions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions