Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
combine if statements
  • Loading branch information
icewind1991 authored and LukasReschke committed Jul 8, 2016
commit d0e6fdba4d38ad7d7d7e95ec4cb752d8b609af5c
23 changes: 10 additions & 13 deletions apps/files_sharing/lib/Controllers/ShareController.php
Original file line number Diff line number Diff line change
Expand Up @@ -285,19 +285,6 @@ public function showShare($token, $path = '') {
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();
Expand All @@ -316,6 +303,16 @@ public function showShare($token, $path = '') {
// 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());

/*
Expand Down