From d0e6fdba4d38ad7d7d7e95ec4cb752d8b609af5c Mon Sep 17 00:00:00 2001 From: Robin Appelman Date: Tue, 5 Jul 2016 23:35:32 +0200 Subject: combine if statements --- .../lib/Controllers/ShareController.php | 23 ++++++++++------------ 1 file changed, 10 insertions(+), 13 deletions(-) diff --git a/apps/files_sharing/lib/Controllers/ShareController.php b/apps/files_sharing/lib/Controllers/ShareController.php index c439735c065..11359e5f2f2 100644 --- a/apps/files_sharing/lib/Controllers/ShareController.php +++ b/apps/files_sharing/lib/Controllers/ShareController.php @@ -285,19 +285,6 @@ class ShareController extends Controller { throw $e; } - $rootFolder = null; - if ($share->getNode() instanceof \OCP\Files\Folder) { - /** @var \OCP\Files\Folder $rootFolder */ - $rootFolder = $share->getNode(); - - try { - $folderNode = $rootFolder->get($path); - } catch (\OCP\Files\NotFoundException $e) { - $this->emitAccessShareHook($share, 404, 'Share not found'); - throw new NotFoundException(); - } - } - $shareTmpl = []; $shareTmpl['displayName'] = $this->userManager->get($share->getShareOwner())->getDisplayName(); $shareTmpl['owner'] = $share->getShareOwner(); @@ -316,6 +303,16 @@ class ShareController extends Controller { // Show file list $hideFileList = false; if ($share->getNode() instanceof \OCP\Files\Folder) { + /** @var \OCP\Files\Folder $rootFolder */ + $rootFolder = $share->getNode(); + + try { + $folderNode = $rootFolder->get($path); + } catch (\OCP\Files\NotFoundException $e) { + $this->emitAccessShareHook($share, 404, 'Share not found'); + throw new NotFoundException(); + } + $shareTmpl['dir'] = $rootFolder->getRelativePath($folderNode->getPath()); /* -- cgit v1.2.3