diff options
author | Morris Jobke <hey@morrisjobke.de> | 2018-10-09 11:47:14 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-10-09 11:47:14 +0200 |
commit | ea411ccec4095e155755b4edf76fd1490e509e5d (patch) | |
tree | fbe572282600012fb03849e03596967f2750c381 /lib | |
parent | a4e8b4ea561da64a67e976cbc74ecf6497fcdaab (diff) | |
parent | ade61d8b433be7d1ebcc4e50e718993a125b97f1 (diff) | |
download | nextcloud-server-ea411ccec4095e155755b4edf76fd1490e509e5d.tar.gz nextcloud-server-ea411ccec4095e155755b4edf76fd1490e509e5d.zip |
Merge pull request #11677 from nextcloud/feature/appdata_previews
Allow the creationg of previews of files stored in appdata
Diffstat (limited to 'lib')
-rw-r--r-- | lib/private/Preview/GeneratorHelper.php | 19 | ||||
-rw-r--r-- | lib/private/PreviewManager.php | 3 |
2 files changed, 10 insertions, 12 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]; } diff --git a/lib/private/PreviewManager.php b/lib/private/PreviewManager.php index de03861badc..931b0035c4f 100644 --- a/lib/private/PreviewManager.php +++ b/lib/private/PreviewManager.php @@ -195,7 +195,8 @@ class PreviewManager implements IPreview { $this, $this->appData, new GeneratorHelper( - $this->rootFolder + $this->rootFolder, + $this->config ), $this->eventDispatcher ); |