Skip to content

Commit

Permalink
Remove the uploaded file if there is a checksum error
Browse files Browse the repository at this point in the history
  • Loading branch information
jvillafanez authored and phil-davis committed Jun 5, 2019
1 parent 5550d82 commit cbab58b
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions apps/dav/lib/Connector/Sabre/File.php
Original file line number Diff line number Diff line change
Expand Up @@ -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.');
}

Expand Down Expand Up @@ -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.');
}

Expand Down

0 comments on commit cbab58b

Please sign in to comment.