[Bug]: File versions expiration does not work properly #45707
Labels
0. Needs triage
Pending check for reproducibility or if it fits our roadmap
29-feedback
bug
feature: versions
Bug description
The version expiration scheme described in https://docs.nextcloud.com/server/latest/admin_manual/configuration_files/file_versioning.html does not work in all scenarios due to an incomplete condition in
server/apps/files_versions/lib/Storage.php
Line 932 in 3bb0c9b
server/apps/files_versions/lib/Storage.php
Line 601 in 3bb0c9b
Steps to reproduce
versions_retention_obligation => 'auto, D'
Triggered by step 3, some of the existing versions should get removed following the documented scheme. But this does not happen depending on factors that have to be clarified (see below). However, the expiration triggered by D works as expected.
Expected behavior
Old versions get deleted as described in the scheme.
Installation method
Community Docker image
Nextcloud Server version
29
Operating system
Debian/Ubuntu
PHP engine version
PHP 8.2
Web server
Apache (supported)
Database engine version
MariaDB
Is this bug present after an update or on a fresh install?
None
Are you using the Nextcloud Server Encryption module?
Encryption is Disabled
What user-backends are you using?
Configuration report
No response
List of activated Apps
No response
Nextcloud Signing status
No response
Nextcloud Logs
No response
Additional info
The reason for the problems is the incomplete condition mentioned in the bug description. After adding some log messages to Storage.php, I found that
$versionEntity->getMetadataValue('label')
returnsnull
in my case, causing the deletion step to be skipped. I adjusted the condition to the mentioned one inexpireOlderThanMaxForUser()
, then expiration worked as expected.I have no knowledge about the internal structures of Nextcloud, so I cannot tell under which circumstances
getMetadataValue('label')
returnsnull
, but anyhow, I think the two mentioned conditions should be consistent.The text was updated successfully, but these errors were encountered: