Skip to content

Commit c4061a9

Browse files
Merge pull request #57103 from nextcloud/backport/57096/stable31
[stable31] fix(dav): catch NotFound exception in UploadHome::childExists()
2 parents 1499c8c + 575004f commit c4061a9

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 {
@@ -49,7 +50,12 @@ public function getChildren(): array {
4950
}
5051

5152
public function childExists($name): bool {
52-
return !is_null($this->getChild($name));
53+
try {
54+
$this->getChild($name);
55+
return true;
56+
} catch (NotFound $e) {
57+
return false;
58+
}
5359
}
5460

5561
public function delete() {

0 commit comments

Comments
 (0)