Skip to content

Commit

Permalink
fixup! Delete chunks if the move on an upload failed
Browse files Browse the repository at this point in the history
  • Loading branch information
juliushaertl committed Aug 6, 2020
1 parent 0508b15 commit 99f79d3
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion apps/dav/lib/Upload/ChunkingPlugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
namespace OCA\DAV\Upload;

use OCA\DAV\Connector\Sabre\Directory;
use OCA\DAV\Connector\Sabre\Exception\Forbidden;
use Sabre\DAV\Exception\BadRequest;
use Sabre\DAV\Exception\NotFound;
use Sabre\DAV\INode;
Expand Down Expand Up @@ -90,11 +91,12 @@ public function performMove($path, $destination) {
// do a move manually, skipping Sabre's default "delete" for existing nodes
try {
$this->server->tree->move($path, $destination);
} catch (\Exception $e) {
} 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)
Expand Down

0 comments on commit 99f79d3

Please sign in to comment.