Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Delete chunks if the move on an upload failed
Signed-off-by: Julius Härtl <[email protected]>
  • Loading branch information
juliusknorr authored and backportbot[bot] committed Aug 13, 2020
commit 4c9fce62db3e40e323ab816532c18ecc4e55ce05
15 changes: 9 additions & 6 deletions apps/dav/lib/Upload/ChunkingPlugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -69,13 +69,16 @@ function beforeMove($sourcePath, $destination) {
* @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]);
Expand Down