Skip to content

Commit 8f2291d

Browse files
joshtrichardsbackportbot[bot]
authored andcommitted
fix(dav): catch NotFound exception in UploadHome::childExists()
Signed-off-by: Josh <[email protected]>
1 parent e0e80c8 commit 8f2291d

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

apps/dav/lib/Upload/UploadHome.php

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
use OCP\Files\NotFoundException;
1515
use OCP\IUserSession;
1616
use Sabre\DAV\Exception\Forbidden;
17+
use Sabre\DAV\Exception\NotFound;
1718
use Sabre\DAV\ICollection;
1819

1920
class UploadHome implements ICollection {
@@ -72,7 +73,12 @@ public function getChildren(): array {
7273
}
7374

7475
public function childExists($name): bool {
75-
return !is_null($this->getChild($name));
76+
try {
77+
$this->getChild($name);
78+
return true;
79+
} catch (NotFound $e) {
80+
return false;
81+
}
7682
}
7783

7884
public function delete() {

0 commit comments

Comments
 (0)