From cb67bcecf00b5db2ca9dd86b92b6c4cc123b729b Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Fri, 19 Sep 2025 11:47:40 +0200 Subject: [PATCH] fix(trashbin): Translate Nextcloud exception to Sabre exception Signed-off-by: Joas Schilling --- apps/files_trashbin/lib/Sabre/TrashFile.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/apps/files_trashbin/lib/Sabre/TrashFile.php b/apps/files_trashbin/lib/Sabre/TrashFile.php index 29bcde769d962..4b495daf1332a 100644 --- a/apps/files_trashbin/lib/Sabre/TrashFile.php +++ b/apps/files_trashbin/lib/Sabre/TrashFile.php @@ -9,10 +9,16 @@ namespace OCA\Files_Trashbin\Sabre; use OCA\Files_Trashbin\Trashbin; +use OCP\Files\ForbiddenException; +use Sabre\DAV\Exception\Forbidden; class TrashFile extends AbstractTrashFile { public function get() { - return $this->data->getStorage()->fopen(Trashbin::getTrashFilename($this->data->getInternalPath(), $this->getDeletionTime()), 'rb'); + try { + return $this->data->getStorage()->fopen(Trashbin::getTrashFilename($this->data->getInternalPath(), $this->getDeletionTime()), 'rb'); + } catch (ForbiddenException) { + throw new Forbidden(); + } } public function getName(): string {