Skip to content

Commit

Permalink
Merge pull request #46757 from nextcloud/backport/46749/stable28
Browse files Browse the repository at this point in the history
[stable28] fix: add a try and catch for delete versioning
  • Loading branch information
susnux committed Jul 25, 2024
2 parents 9c94775 + 9e1304b commit 109bcfd
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions apps/files_versions/lib/Storage.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@
use OCP\Files\IRootFolder;
use OCP\Files\Node;
use OCP\Files\NotFoundException;
use OCP\Files\NotPermittedException;
use OCP\Files\Search\ISearchBinaryOperator;
use OCP\Files\Search\ISearchComparison;
use OCP\Files\StorageInvalidException;
Expand Down Expand Up @@ -626,8 +627,12 @@ public static function expireOlderThanMaxForUser($uid) {
$versionsMapper->delete($versionEntity);
}

$version->delete();
\OC_Hook::emit('\OCP\Versions', 'delete', ['path' => $internalPath, 'trigger' => self::DELETE_TRIGGER_RETENTION_CONSTRAINT]);
try {
$version->delete();
\OC_Hook::emit('\OCP\Versions', 'delete', ['path' => $internalPath, 'trigger' => self::DELETE_TRIGGER_RETENTION_CONSTRAINT]);
} catch (NotPermittedException $e) {
\OCP\Server::get(LoggerInterface::class)->error("Missing permissions to delete version: {$internalPath}", ['app' => 'files_versions', 'exception' => $e]);
}
}
}

Expand Down

0 comments on commit 109bcfd

Please sign in to comment.