diff options
author | Julius Härtl <jus@bitgrid.net> | 2020-08-06 11:50:31 +0200 |
---|---|---|
committer | backportbot[bot] <backportbot[bot]@users.noreply.github.com> | 2020-08-13 18:55:10 +0000 |
commit | 4c9fce62db3e40e323ab816532c18ecc4e55ce05 (patch) | |
tree | 53a596ad90d601d3ea03686c03089c97e65afb15 /apps/dav/lib | |
parent | d9186601d383cf59f96b140fd45f94fd6bccf34d (diff) | |
download | nextcloud-server-4c9fce62db3e40e323ab816532c18ecc4e55ce05.tar.gz nextcloud-server-4c9fce62db3e40e323ab816532c18ecc4e55ce05.zip |
Delete chunks if the move on an upload failed
Signed-off-by: Julius Härtl <jus@bitgrid.net>
Diffstat (limited to 'apps/dav/lib')
-rw-r--r-- | apps/dav/lib/Upload/ChunkingPlugin.php | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/apps/dav/lib/Upload/ChunkingPlugin.php b/apps/dav/lib/Upload/ChunkingPlugin.php index 704cbf8f578..74892aaffde 100644 --- a/apps/dav/lib/Upload/ChunkingPlugin.php +++ b/apps/dav/lib/Upload/ChunkingPlugin.php @@ -69,13 +69,16 @@ class ChunkingPlugin extends ServerPlugin { * @return bool|void false to stop handling, void to skip this handler */ public function performMove($path, $destination) { - if (!$this->server->tree->nodeExists($destination)) { - // skip and let the default handler do its work - return; - } - // do a move manually, skipping Sabre's default "delete" for existing nodes - $this->server->tree->move($path, $destination); + try { + $this->server->tree->move($path, $destination); + } catch (Forbidden $e) { + $sourceNode = $this->server->tree->getNodeForPath($path); + if ($sourceNode instanceof FutureFile) { + $sourceNode->delete(); + } + throw $e; + } // trigger all default events (copied from CorePlugin::move) $this->server->emit('afterMove', [$path, $destination]); |