[Bug]: The CreateVersionEvent event of file versions is never fired
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
The CreateVersionEvent event is never triggered and is a behavior that is not even seen because there are no tests on it]:
https://github.com/search?q=repo%3Anextcloud%2Fserver%20CreateVersionEvent&type=code
It is only triggered here:
That Storage::store method is only called from here:
The problem is that it always comes up here:
Why write_hook is called from here:
And the node is of type NonExistingFile always...
Steps to reproduce
- Be subscribed in an app to the CreateVersionEvent event (or put a log here).
- Upload a file through the UI or through WebDav
- Check that it never arrives and always goes out here
It also occurs when copying or moving files or folders with files in it
Expected behavior
The event should be launched
Nextcloud Server version
31
Operating system
Debian/Ubuntu
PHP engine version
PHP 8.3
Web server
Nginx
Database engine version
None
Is this bug present after an update or on a fresh install?
Fresh Nextcloud Server install
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
Nextcloud Logs
Additional info
No response
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 in apps/files_versions/lib/Listener/FileEventsListener.php, following the write_hook path around the reported lines and the NonExistingFile handling. Then inspect apps/files_versions/lib/Storage.php and Events/CreateVersionEvent.php to trace when the event is dispatched during uploads, copies, and moves. Done means the event is fired for these file-version operations and coverage is added for the previously untested behavior.
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
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100