Ignore and log non integer versions

This avoids being stuck when there is one buggy file version with a
 non-integer version. It allows the expiration process to not crash and
 continue with the other ones.

Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
This commit is contained in:
Côme Chilliet 2023-03-27 17:37:16 +02:00
parent 2dc96b3148
commit 8cc8765089
No known key found for this signature in database
GPG key ID: A3E2F658B28C760A

View file

@ -716,6 +716,12 @@ class Storage {
}
foreach ($versions as $key => $version) {
if (!is_int($version['version'])) {
\OC::$server->get(LoggerInterface::class)->error(
'Found a non-numeric timestamp version: '. json_encode($version),
['app' => 'files_versions']);
continue;
}
if ($expiration->isExpired($version['version'], $quotaExceeded) && !isset($toDelete[$key])) {
$size += $version['size'];
$toDelete[$key] = $version['path'] . '.v' . $version['version'];