diff options
author | Thomas Müller <thomas.mueller@tmit.eu> | 2015-01-14 22:39:19 +0100 |
---|---|---|
committer | Thomas Müller <thomas.mueller@tmit.eu> | 2015-01-14 22:39:19 +0100 |
commit | 337c43ce9266106c803e6593e2006fd2b11b4f81 (patch) | |
tree | 3f30c3f015f7110d1700d8dd6550227e66f60f40 /lib/private | |
parent | 64d7463ca369ccf7b141e6699f8973781e531bd4 (diff) | |
parent | 96dff341e271f2c662f35fe0888e7e0992a8d33b (diff) | |
download | nextcloud-server-337c43ce9266106c803e6593e2006fd2b11b4f81.tar.gz nextcloud-server-337c43ce9266106c803e6593e2006fd2b11b4f81.zip |
Merge pull request #13317 from owncloud/partfile-fileinfo
Return valid fileinfo objects for part files
Diffstat (limited to 'lib/private')
-rw-r--r-- | lib/private/files/view.php | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/lib/private/files/view.php b/lib/private/files/view.php index 57441c8e680..76b7d34e756 100644 --- a/lib/private/files/view.php +++ b/lib/private/files/view.php @@ -906,6 +906,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); @@ -1318,4 +1321,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 + ); + } } |