Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: File versions expiration does not work properly #45707

Closed
5 of 8 tasks
carhe opened this issue Jun 7, 2024 · 3 comments · Fixed by #45932
Closed
5 of 8 tasks

[Bug]: File versions expiration does not work properly #45707

carhe opened this issue Jun 7, 2024 · 3 comments · Fixed by #45932
Labels
0. Needs triage Pending check for reproducibility or if it fits our roadmap 29-feedback bug feature: versions

Comments

@carhe
Copy link
Contributor

carhe commented Jun 7, 2024

⚠️ This issue respects the following points: ⚠️

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

if ($versionEntity->getMetadataValue('label') !== '') {
The condition should match the one in
if ($versionEntity->getMetadataValue('label') !== null && $versionEntity->getMetadataValue('label') !== '') {

Steps to reproduce

  1. set versions_retention_obligation => 'auto, D'
  2. add and update a file several times to generate some versions in files_versions/...
  3. wait some time and update again

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?

  • Default user-backend (database)
  • LDAP/ Active Directory
  • SSO - SAML
  • Other

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') returns null in my case, causing the deletion step to be skipped. I adjusted the condition to the mentioned one in expireOlderThanMaxForUser(), then expiration worked as expected.

I have no knowledge about the internal structures of Nextcloud, so I cannot tell under which circumstances getMetadataValue('label') returns null, but anyhow, I think the two mentioned conditions should be consistent.

@carhe carhe added 0. Needs triage Pending check for reproducibility or if it fits our roadmap bug labels Jun 7, 2024
@carhe carhe changed the title [Bug]: File versions expiration not working properly [Bug]: File versions expiration does not work properly Jun 7, 2024
@solracsf
Copy link
Member

solracsf commented Jun 9, 2024

Cc @artonge

@artonge
Copy link
Contributor

artonge commented Jun 10, 2024

@carhe could you create a PR?

@carhe
Copy link
Contributor Author

carhe commented Jun 17, 2024

Sorry for the delay. So, I created PR #45932.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
0. Needs triage Pending check for reproducibility or if it fits our roadmap 29-feedback bug feature: versions
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants