Skip to content

Commit

Permalink
Merge pull request #37428 from nextcloud/enh/ignore-non-numeric-versions
Browse files Browse the repository at this point in the history
Ignore and log non integer versions
  • Loading branch information
come-nc authored Apr 20, 2023
2 parents c909e92 + a6b1d99 commit 60b7d21
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion apps/files_versions/lib/Storage.php
Original file line number Diff line number Diff line change
Expand Up @@ -710,7 +710,13 @@ protected static function getExpireList($time, $versions, $quotaExceeded = false
}

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

0 comments on commit 60b7d21

Please sign in to comment.