diff options
author | Vincent Petry <pvince81@owncloud.com> | 2014-03-12 16:57:39 +0100 |
---|---|---|
committer | Vincent Petry <pvince81@owncloud.com> | 2014-03-17 13:04:34 +0100 |
commit | 4033eba374cde80751c393e1f6ed5c647661f4c8 (patch) | |
tree | bae614d3ec1035a5d7d22ecf8c3a3ebe49abdb83 /lib/private/connector | |
parent | bd98538a3646e4f7a56a16e93889e4d3079501d6 (diff) | |
download | nextcloud-server-4033eba374cde80751c393e1f6ed5c647661f4c8.tar.gz nextcloud-server-4033eba374cde80751c393e1f6ed5c647661f4c8.zip |
Fixed chunking and insufficient storage check
- fixed free space detection based on the already uploaded chunks
- now deleting chunks as soon as it is read out before writing it into
the part file, which reduces the space needed when assembling part
files
Diffstat (limited to 'lib/private/connector')
-rw-r--r-- | lib/private/connector/sabre/quotaplugin.php | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/lib/private/connector/sabre/quotaplugin.php b/lib/private/connector/sabre/quotaplugin.php index 8099794f670..227e684741c 100644 --- a/lib/private/connector/sabre/quotaplugin.php +++ b/lib/private/connector/sabre/quotaplugin.php @@ -56,8 +56,19 @@ class OC_Connector_Sabre_QuotaPlugin extends Sabre_DAV_ServerPlugin { $uri='/'.$uri; } list($parentUri, $newName) = Sabre_DAV_URLUtil::splitPath($uri); + $req = $this->server->httpRequest; + if ($req->getHeader('OC-Chunked')) { + $info = OC_FileChunking::decodeName($newName); + $chunkHandler = new OC_FileChunking($info); + // substract the already uploaded size to see whether + // there is still enough space for the remaining chunks + $length -= $chunkHandler->getCurrentSize(); + } $freeSpace = $this->getFreeSpace($parentUri); if ($freeSpace !== \OC\Files\SPACE_UNKNOWN && $length > $freeSpace) { + if (isset($chunkHandler)) { + $chunkHandler->cleanup(); + } throw new Sabre_DAV_Exception_InsufficientStorage(); } } |