From cbab58b712fef4eeec07067879c2ab13477a8382 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Juan=20Pablo=20Villaf=C3=A1=C3=B1ez?= Date: Tue, 21 May 2019 14:06:13 +0200 Subject: [PATCH] Remove the uploaded file if there is a checksum error --- apps/dav/lib/Connector/Sabre/File.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/apps/dav/lib/Connector/Sabre/File.php b/apps/dav/lib/Connector/Sabre/File.php index cbcedce05fad..dc118b1c0204 100644 --- a/apps/dav/lib/Connector/Sabre/File.php +++ b/apps/dav/lib/Connector/Sabre/File.php @@ -208,6 +208,7 @@ public function put($data) { } if (!self::isChecksumValid($partStorage, $internalPartPath)) { + $partStorage->unlink($internalPartPath); // remove the uploaded file on checksum error throw new BadRequest('The computed checksum does not match the one received from the client.'); } @@ -535,6 +536,7 @@ private function createFileChunked($data) { $chunk_handler->file_assemble($partStorage, $partInternalPath); if (!self::isChecksumValid($partStorage, $partInternalPath)) { + $partStorage->unlink($partInternalPath); // remove the uploaded file on checksum error throw new BadRequest('The computed checksum does not match the one received from the client.'); }