Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/server.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorRobin Appelman <icewind@owncloud.com>2015-01-13 15:59:28 +0300
committerMorris Jobke <hey@morrisjobke.de>2015-01-15 02:22:38 +0300
commit0f04bfc31964066ddd211b50f3db40be9b9b9aae (patch)
tree6c108d73866247273bbb49e10f22981bfb0bfb10 /lib
parent4d42485bf5a3d0af69d196a46c2b499112af515c (diff)
Return valid fileinfo objects for part files
Diffstat (limited to 'lib')
-rw-r--r--lib/private/files/view.php31
1 files changed, 31 insertions, 0 deletions
diff --git a/lib/private/files/view.php b/lib/private/files/view.php
index 8c123b8244c..430e9e6900b 100644
--- a/lib/private/files/view.php
+++ b/lib/private/files/view.php
@@ -873,6 +873,9 @@ class View {
if (!Filesystem::isValidPath($path)) {
return $data;
}
+ if (Cache\Scanner::isPartialFile($path)) {
+ return $this->getPartFileInfo($path);
+ }
$path = Filesystem::normalizePath($this->fakeRoot . '/' . $path);
$mount = Filesystem::getMountManager()->find($path);
@@ -1259,4 +1262,32 @@ class View {
return $result;
}
+
+ /**
+ * Get a fileinfo object for files that are ignored in the cache (part files)
+ *
+ * @param string $path
+ * @return \OCP\Files\FileInfo
+ */
+ private function getPartFileInfo($path) {
+ $mount = $this->getMount($path);
+ $storage = $mount->getStorage();
+ $internalPath = $mount->getInternalPath($this->getAbsolutePath($path));
+ return new FileInfo(
+ $this->getAbsolutePath($path),
+ $storage,
+ $internalPath,
+ [
+ 'fileid' => null,
+ 'mimetype' => $storage->getMimeType($internalPath),
+ 'name' => basename($path),
+ 'etag' => null,
+ 'size' => $storage->filesize($internalPath),
+ 'mtime' => $storage->filemtime($internalPath),
+ 'encrypted' => false,
+ 'permissions' => \OCP\Constants::PERMISSION_ALL
+ ],
+ $mount
+ );
+ }
}