Cannot create directories on WebDAV external storage when trailing slash is omitted
Nobody has claimed this yet.
- Dominant language
- PHP
- Stars
- 36.9k
- Forks
- 5.2k
- Avg merge
- 2d 3h
- Merged PRs (30d)
- 713
Description
⚠️ This issue respects the following points: ⚠️
- This is a bug, not a question or a configuration/webserver/proxy issue.
- This issue is not already reported on Github (I've searched it).
- Nextcloud Server is up to date. See Maintenance and Release Schedule for supported versions.
- Nextcloud Server is running on 64bit capable CPU, PHP and OS.
- I agree to follow Nextcloud's Code of Conduct.
Bug description
When trying to create a directory in WebDAV external storage I see the following error in the WebDAV server: MKCOL can create a collection only server: , request: "MKCOL /images HTTP/1.1 As discussed at https://trac.nginx.org/nginx/ticket/1966 Nginx requires a trailing slash, this seems to be a requirement in WebDAV. This function https://github.com/nextcloud/server/blob/dda79b583df319a375e9b012a39bb97490034679/lib/private/Files/Utils/PathHelper.php#L52 removes the trailing slash and it is indirectly used in mkdir https://github.com/nextcloud/server/blob/dda79b583df319a375e9b012a39bb97490034679/lib/private/Files/Storage/DAV.php#L190
A complicated workaround for NGINX exists https://www.robpeck.com/2020/06/making-webdav-actually-work-on-nginx/
Steps to reproduce
- Try to create a new directory on an Nginx webDAV server
Expected behavior
The MKCOL request includes a trailing slash
Installation method
Community Docker image
Operating system
Debian/Ubuntu
PHP engine version
None
Web server
None
Database engine version
None
Is this bug present after an update or on a fresh install?
None
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
NA
List of activated Apps
NA
Nextcloud Signing status
NA
Nextcloud Logs
NA
Additional info
NA
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with lib/private/Files/Utils/PathHelper.php around line 52 and lib/private/Files/Storage/DAV.php around line 190, tracing how the directory path reaches mkdir. Reproduce creation against an Nginx WebDAV server and verify that the resulting MKCOL request includes a trailing slash without breaking other directory creation cases.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- nginx, php
- Domain
- backend, networking
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 42/100