From 58a4a222d0e710fca513f968735fb6cdb95e7f92 Mon Sep 17 00:00:00 2001 From: Robin Appelman Date: Wed, 21 Jun 2023 15:29:39 +0200 Subject: clean failed upload chunks Signed-off-by: Robin Appelman --- apps/dav/lib/Upload/UploadFolder.php | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'apps/dav') diff --git a/apps/dav/lib/Upload/UploadFolder.php b/apps/dav/lib/Upload/UploadFolder.php index 66c190d84d9..a1dade0e865 100644 --- a/apps/dav/lib/Upload/UploadFolder.php +++ b/apps/dav/lib/Upload/UploadFolder.php @@ -47,7 +47,15 @@ class UploadFolder implements ICollection { public function createFile($name, $data = null) { // TODO: verify name - should be a simple number - $this->node->createFile($name, $data); + try { + $this->node->createFile($name, $data); + } catch (\Exception $e) { + if ($this->node->childExists($name)) { + $child = $this->node->getChild($name); + $child->delete(); + } + throw $e; + } } public function createDirectory($name) { -- cgit v1.2.3