]> source.dussan.org Git - nextcloud-server.git/commitdiff
Allow getting info or renaming part files through WebDAV
authorVincent Petry <pvince81@owncloud.com>
Wed, 27 Nov 2013 11:46:12 +0000 (12:46 +0100)
committerVincent Petry <pvince81@owncloud.com>
Thu, 23 Jan 2014 17:42:56 +0000 (18:42 +0100)
When mounting an ownCloud (backend OC) inside another ownCloud (frontend
OC), the frontend OC will use WebDAV to upload file, which will create
part files. These part files need to be accessible for the frontend OC
to rename them to the actual file name.

This fix leaves the file cache untouched but gives direct access to part
file info when requested.

This means that part file can be accessed only when their path and name
are known. These won't appear in file listtings.

Fixes #6068

lib/private/connector/sabre/objecttree.php

index cd3f081f7ccf73d4e8e31be9657f503ca73071f1..d1e179af2ec5eb468f3c92e8ba6780b70ebb5f49 100644 (file)
@@ -38,7 +38,20 @@ class ObjectTree extends \Sabre_DAV_ObjectTree {
                        return $this->rootNode;
                }
 
-               $info = $this->getFileView()->getFileInfo($path);
+               if (pathinfo($path, PATHINFO_EXTENSION) === 'part') {
+                       // read from storage
+                       $absPath = $this->getFileView()->getAbsolutePath($path);
+                       list($storage, $internalPath) = Filesystem::resolvePath('/' . $absPath);
+                       if ($storage) {
+                               $scanner = $storage->getScanner($internalPath);
+                               // get data directly
+                               $info = $scanner->getData($internalPath);
+                       }
+               }
+               else {
+                       // read from cache
+                       $info = $this->getFileView()->getFileInfo($path);
+               }
 
                if (!$info) {
                        throw new \Sabre_DAV_Exception_NotFound('File with name ' . $path . ' could not be located');