Skip to content

Commit 4aeb24f

Browse files
Merge pull request #55189 from nextcloud/backport/55183/stable32
[stable32] fix(trashbin): Translate Nextcloud exception to Sabre exception
2 parents 6c8d2c8 + 36b7a96 commit 4aeb24f

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

apps/files_trashbin/lib/Sabre/TrashFile.php

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,16 @@
99
namespace OCA\Files_Trashbin\Sabre;
1010

1111
use OCA\Files_Trashbin\Trashbin;
12+
use OCP\Files\ForbiddenException;
13+
use Sabre\DAV\Exception\Forbidden;
1214

1315
class TrashFile extends AbstractTrashFile {
1416
public function get() {
15-
return $this->data->getStorage()->fopen(Trashbin::getTrashFilename($this->data->getInternalPath(), $this->getDeletionTime()), 'rb');
17+
try {
18+
return $this->data->getStorage()->fopen(Trashbin::getTrashFilename($this->data->getInternalPath(), $this->getDeletionTime()), 'rb');
19+
} catch (ForbiddenException) {
20+
throw new Forbidden();
21+
}
1622
}
1723

1824
public function getName(): string {

0 commit comments

Comments
 (0)