]> source.dussan.org Git - nextcloud-server.git/commitdiff
combine if statements
authorRobin Appelman <icewind@owncloud.com>
Tue, 5 Jul 2016 21:35:32 +0000 (23:35 +0200)
committerLukas Reschke <lukas@statuscode.ch>
Fri, 8 Jul 2016 10:36:15 +0000 (12:36 +0200)
apps/files_sharing/lib/Controllers/ShareController.php

index c439735c06571092f6639dcd814b69e6dec69747..11359e5f2f29c4e191dc57be0796c9a150ed2631 100644 (file)
@@ -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());
 
                        /*