summaryrefslogtreecommitdiffstats
path: root/lib/private/files
diff options
context:
space:
mode:
authorRobin Appelman <icewind@owncloud.com>2015-01-13 13:59:28 +0100
committerRobin Appelman <icewind@owncloud.com>2015-01-13 13:59:28 +0100
commit96dff341e271f2c662f35fe0888e7e0992a8d33b (patch)
tree47242d6dc0df6266fd2eb9c273a018ce7ce02d70 /lib/private/files
parent6d73aff9ad44f81b65b6ddc74f06a59e562f971b (diff)
downloadnextcloud-server-96dff341e271f2c662f35fe0888e7e0992a8d33b.tar.gz
nextcloud-server-96dff341e271f2c662f35fe0888e7e0992a8d33b.zip
Return valid fileinfo objects for part files
Diffstat (limited to 'lib/private/files')
-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 034c49a9059..a849f8b8871 100644
--- a/lib/private/files/view.php
+++ b/lib/private/files/view.php
@@ -896,6 +896,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);
@@ -1308,4 +1311,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
+ );
+ }
}