summaryrefslogtreecommitdiffstats
path: root/lib/connector/sabre
diff options
context:
space:
mode:
authorThomas Müller <thomas.mueller@tmit.eu>2013-09-25 17:28:45 +0200
committerThomas Müller <thomas.mueller@tmit.eu>2013-09-25 17:28:45 +0200
commit0c44cdd4eaa82687bce4dbbb24338b16a3f4ed13 (patch)
tree3ff89d310fa68beaeec659a71e9934bd4d291082 /lib/connector/sabre
parent5e27ac4b1ade3a78941ced1eef5aaa2d2df0cedf (diff)
downloadnextcloud-server-0c44cdd4eaa82687bce4dbbb24338b16a3f4ed13.tar.gz
nextcloud-server-0c44cdd4eaa82687bce4dbbb24338b16a3f4ed13.zip
remove unneccessary code
Diffstat (limited to 'lib/connector/sabre')
-rw-r--r--lib/connector/sabre/aborteduploaddetectionplugin.php24
1 files changed, 11 insertions, 13 deletions
diff --git a/lib/connector/sabre/aborteduploaddetectionplugin.php b/lib/connector/sabre/aborteduploaddetectionplugin.php
index 1173ff2f9aa..74c26f41b65 100644
--- a/lib/connector/sabre/aborteduploaddetectionplugin.php
+++ b/lib/connector/sabre/aborteduploaddetectionplugin.php
@@ -43,21 +43,16 @@ class OC_Connector_Sabre_AbortedUploadDetectionPlugin extends Sabre_DAV_ServerPl
$this->server = $server;
- $server->subscribeEvent('afterCreateFile', array($this, 'afterCreateFile'), 10);
- $server->subscribeEvent('afterWriteContent', array($this, 'afterWriteContent'), 10);
+ $server->subscribeEvent('afterCreateFile', array($this, 'verifyContentLength'), 10);
+ $server->subscribeEvent('afterWriteContent', array($this, 'verifyContentLength'), 10);
}
- function afterCreateFile($path, Sabre_DAV_ICollection $parent) {
-
- $this->verifyContentLength($path);
-
- }
-
- function afterWriteContent($path, Sabre_DAV_IFile $node) {
- $this->verifyContentLength($path);
- }
-
- function verifyContentLength($filePath) {
+ /**
+ * @param $filePath
+ * @param Sabre_DAV_INode $node
+ * @throws Sabre_DAV_Exception_BadRequest
+ */
+ public function verifyContentLength($filePath, Sabre_DAV_INode $node = null) {
// ownCloud chunked upload will be handled in it's own plugin
$chunkHeader = $this->server->httpRequest->getHeader('OC-Chunked');
@@ -67,6 +62,9 @@ class OC_Connector_Sabre_AbortedUploadDetectionPlugin extends Sabre_DAV_ServerPl
// compare expected and actual size
$expected = $this->getLength();
+ if (!$expected) {
+ return;
+ }
$actual = $this->getFileView()->filesize($filePath);
if ($actual != $expected) {
$this->getFileView()->unlink($filePath);