Merge pull request #38930 from nextcloud/chunk-clean-failed

clean failed upload chunks
This commit is contained in:
Robin Appelman 2023-07-20 19:29:42 +02:00 committed by GitHub
commit 6cf3e4b82c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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) {