summaryrefslogtreecommitdiffstats
path: root/lib/private/Preview
diff options
context:
space:
mode:
authorRoeland Jago Douma <roeland@famdouma.nl>2018-10-08 14:35:35 +0200
committerRoeland Jago Douma <roeland@famdouma.nl>2018-10-08 19:37:45 +0200
commitade61d8b433be7d1ebcc4e50e718993a125b97f1 (patch)
tree5e87cff46e68cdd11632628c0760242cfab2cc22 /lib/private/Preview
parent7971ba5cc66201830e5b4b141d2478efa2257c75 (diff)
downloadnextcloud-server-ade61d8b433be7d1ebcc4e50e718993a125b97f1.tar.gz
nextcloud-server-ade61d8b433be7d1ebcc4e50e718993a125b97f1.zip
Allow the creationg of previews of files stored in appdata
To allow us to create previews of files stored in appdata we need to construct the view differently. Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
Diffstat (limited to 'lib/private/Preview')
-rw-r--r--lib/private/Preview/GeneratorHelper.php19
1 files changed, 8 insertions, 11 deletions
diff --git a/lib/private/Preview/GeneratorHelper.php b/lib/private/Preview/GeneratorHelper.php
index 587f8174b02..2f1a1f8aeff 100644
--- a/lib/private/Preview/GeneratorHelper.php
+++ b/lib/private/Preview/GeneratorHelper.php
@@ -26,6 +26,7 @@ use OC\Files\View;
use OCP\Files\File;
use OCP\Files\IRootFolder;
use OCP\Files\SimpleFS\ISimpleFile;
+use OCP\IConfig;
use OCP\IImage;
use OCP\Image as OCPImage;
use OCP\Preview\IProvider;
@@ -38,8 +39,12 @@ class GeneratorHelper {
/** @var IRootFolder */
private $rootFolder;
- public function __construct(IRootFolder $rootFolder) {
+ /** @var IConfig */
+ private $config;
+
+ public function __construct(IRootFolder $rootFolder, IConfig $config) {
$this->rootFolder = $rootFolder;
+ $this->config = $config;
}
/**
@@ -60,16 +65,8 @@ class GeneratorHelper {
* This is required to create the old view and path
*/
private function getViewAndPath(File $file) {
- $absPath = ltrim($file->getPath(), '/');
- $owner = explode('/', $absPath)[0];
-
- $userFolder = $this->rootFolder->getUserFolder($owner)->getParent();
-
- $nodes = $userFolder->getById($file->getId());
- $file = $nodes[0];
-
- $view = new View($userFolder->getPath());
- $path = $userFolder->getRelativePath($file->getPath());
+ $view = new View($file->getParent()->getPath());
+ $path = $file->getName();
return [$view, $path];
}