Skip to content

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

Closed

Description

⚠️ 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions