Merge pull request #5402 from owncloud/fixing-5367-master

fixes chunked upload
This commit is contained in:
Thomas Müller 2013-10-24 00:56:46 -07:00
commit 808e9b0f51
2 changed files with 11 additions and 1 deletions

View file

@ -222,7 +222,7 @@ class OC_Connector_Sabre_File extends OC_Connector_Sabre_Node implements Sabre_D
if (isset($_SERVER['CONTENT_LENGTH'])) { if (isset($_SERVER['CONTENT_LENGTH'])) {
$expected = $_SERVER['CONTENT_LENGTH']; $expected = $_SERVER['CONTENT_LENGTH'];
if ($bytesWritten != $expected) { if ($bytesWritten != $expected) {
$chunk_handler->cleanup(); $chunk_handler->remove($info['index']);
throw new Sabre_DAV_Exception_BadRequest( throw new Sabre_DAV_Exception_BadRequest(
'expected filesize ' . $expected . ' got ' . $bytesWritten); 'expected filesize ' . $expected . ' got ' . $bytesWritten);
} }

View file

@ -85,6 +85,16 @@ class OC_FileChunking {
} }
} }
/**
* Removes one specific chunk
* @param $index
*/
public function remove($index) {
$cache = $this->getCache();
$prefix = $this->getPrefix();
$cache->remove($prefix.$index);
}
public function signature_split($orgfile, $input) { public function signature_split($orgfile, $input) {
$info = unpack('n', fread($input, 2)); $info = unpack('n', fread($input, 2));
$blocksize = $info[1]; $blocksize = $info[1];