[Bug]: Files from user directory lost when added to grup with groupfolder of the same name
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 OR Nextcloud Community Forum (I've searched it).
- Nextcloud Server is up to date. See Maintenance and Release Schedule for supported versions.
- I agree to follow Nextcloud's Code of Conduct.
Bug description
If there's an users directory named for example 'aaa' in user's main directory, and one creates a group directory named 'aaa' and adds the user to the group, the user's directory 'aaa' gets correctly renamed to 'aaa (1)' (looks like intended behaviour to avoid name conflicts) and all subdirectories of 'aaa' get moved to 'aaa (1)', but files get lost. The files get removed from local drives by Nextcloud client apps.
Steps to reproduce
- Create directory named 'aaa' in user's main directory. Create subdir 'aaa/bbb' and 'aaa/ccc'. Make some test files inside subdirs.
- Make grup directory 'aaa' owned by a group
- Add the user to the grup
- The user's 'aaa' directory gets renamed to 'aaa (1)', and all directories from the original 'aaa' dir ('aaa/bbb' and 'aaa/ccc') will be moved to 'aaa (1)/bbb' and 'aaa (1)/ccc', but with no files inside.
- The test files get removed from local drives by the Nextcloud local clients.
- The new 'aaa' group directory remains empty.
Expected behavior
I expect the renamed, user's directory 'aaa (1)' contains same directory and files as the original 'aaa' directory.
Nextcloud Server version
32
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
List of activated Apps
Nextcloud Signing status
No errors have been found.
Nextcloud Logs
Warning
PHP
Undefined array key "node" at /var/www/html/custom_apps/notes/lib/Service/NoteUtil.php#201
14 kwi 2026, 09:31:26
Error
core
unable to rename, file does not exists : files/OTAS
14 kwi 2026, 09:27:17
Error
no app in context
TypeError
readdir(): Argument #1 ($dir_handle) must be of type resource or null, false given
14 kwi 2026, 09:27:17
Error
webdav
TypeError
readdir(): Argument #1 ($dir_handle) must be of type resource or null, false given
14 kwi 2026, 09:27:17
Warning
PHP
opendir(/mnt/ncdata/maciek/files/OTAS): Failed to open directory: No such file or directory at /var/www/html/lib/private/Files/Storage/Local.php#130
14 kwi 2026, 09:27:17
Warning
PHP
Attempt to read property "name" on null at /var/www/html/custom_apps/integration_openproject/lib/Controller/ConfigController.php#494
14 kwi 2026, 09:09:57
Additional info
Nextcloud Hub 25 Autumn (32.0.8)
Running in Nextcloud AIO.
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
Reproduce the conflict using the six listed steps, then start at lib/private/Files/Storage/Local.php around line 130 and review the rename and directory traversal behavior. Check the related WebDAV and core log errors while tracing the move. Done means the renamed user directory retains both its subdirectories and files, while the group directory remains available.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- php
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100