diff options
author | Jörn Friedrich Dreyer <jfd@butonic.de> | 2013-02-11 09:43:26 +0100 |
---|---|---|
committer | Jörn Friedrich Dreyer <jfd@butonic.de> | 2013-02-11 09:43:26 +0100 |
commit | 72a2075b1c25409a2bccde62809eff76812b9a25 (patch) | |
tree | 58d860884bd006bbe9b972bc2a5da7f9f8624026 | |
parent | 2644003bf1f82eb812981d27237ec0ce4e026604 (diff) | |
download | nextcloud-server-72a2075b1c25409a2bccde62809eff76812b9a25.tar.gz nextcloud-server-72a2075b1c25409a2bccde62809eff76812b9a25.zip |
readd renaming and mtime handling to new directory nodes
-rw-r--r-- | lib/connector/sabre/directory.php | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/lib/connector/sabre/directory.php b/lib/connector/sabre/directory.php index c4062170d5e..d8d74b922ab 100644 --- a/lib/connector/sabre/directory.php +++ b/lib/connector/sabre/directory.php @@ -62,7 +62,23 @@ class OC_Connector_Sabre_Directory extends OC_Connector_Sabre_Node implements Sa } } else { $newPath = $this->path . '/' . $name; - \OC\Files\Filesystem::file_put_contents($newPath, $data); + + // mark file as partial while uploading (ignored by the scanner) + $partpath = $newPath . '.part'; + + \OC\Files\Filesystem::file_put_contents($partpath, $data); + + // rename to correct path + \OC\Files\Filesystem::rename($partpath, $newPath); + + // allow sync clients to send the mtime along in a header + $mtime = OC_Request::hasModificationTime(); + if ($mtime !== false) { + if(\OC\Files\Filesystem::touch($newPath, $mtime)) { + header('X-OC-MTime: accepted'); + } + } + return OC_Connector_Sabre_Node::getETagPropertyForPath($newPath); } |