-
-
Notifications
You must be signed in to change notification settings - Fork 4.7k
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
When a folder is copied or moved, the file events that arrives is of folder type, not of each file that has been copied or moved within the folder.
This causes that recursively it is necessary in that events to read with getDirectoryListing() all the nodes of type file.
It causes a race condition when using this API:
| $this->versionManager->setMetadataValue($node, $node->getMTime(), 'author', $author); |
Did expect one result but found none when executing: query \"SELECT * FROM `*PREFIX*files_versions` WHERE (`file_id` = :dcValue1) AND (`timestamp` = :dcValue2)\"
It would be solved by creating a VersionCreatedEvent event similar to VersionRestoredEvent.
This way we are always sure that when we are going to write the metadata of a version is the right time and solve the fragility that the timestamp / revision field is mapped to node->getMTime() and sometimes make it impossible for you to obtain a file version for that + 1 in catch:
| $versionEntity->setTimestamp($versionEntity->getTimestamp() + 1); |
Steps to reproduce
- Copy or move a folder with files in it.
- Subscribe to the
NodeWrittenEventevent and call the$this->versionManager->setMetadataValueAPI. - Check that the error occurs.
Did expect one result but found none when executing: query \"SELECT * FROM `*PREFIX*files_versions` WHERE (`file_id` = :dcValue1) AND (`timestamp` = :dcValue2)\"
Expected behavior
It should allow you to use the $this->versionManager->setMetadataValue API without errors.
Nextcloud Server version
31
Operating system
Debian/Ubuntu
PHP engine version
PHP 8.3
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
Nextcloud Logs
Additional info
No response