Skip to content

Commit

Permalink
fix: Cleanup
Browse files Browse the repository at this point in the history
Signed-off-by: Julius Härtl <jus@bitgrid.net>
  • Loading branch information
juliushaertl committed Aug 31, 2023
1 parent 001651d commit 40f63c1
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 24 deletions.
6 changes: 5 additions & 1 deletion lib/Controller/DocumentController.php
Original file line number Diff line number Diff line change
Expand Up @@ -428,7 +428,7 @@ private function getFileForUser(int $fileId, string $path = null): File {
* @throws NotFoundException
* @throws NotPermittedException
*/
private function getFileForShare(IShare $share, int $fileId, ?string $path = null): File {
private function getFileForShare(IShare $share, ?int $fileId, ?string $path = null): File {
// not authenticated ?
if ($share->getPassword()) {
if (!$this->session->exists('public_link_authenticated')
Expand All @@ -447,6 +447,10 @@ private function getFileForShare(IShare $share, int $fileId, ?string $path = nul
return $node;
}

if ($fileId === null && $path === null) {
throw new NotFoundException();
}

if ($path !== null) {
$node = $node->get($path);
} else {
Expand Down
34 changes: 11 additions & 23 deletions lib/Service/InitialStateService.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,34 +28,21 @@
use OCA\Richdocuments\AppInfo\Application;
use OCA\Richdocuments\Db\Wopi;
use OCP\AppFramework\Services\IInitialState;
use OCP\Defaults;
use OCP\IConfig;
use OCP\IURLGenerator;

class InitialStateService {
/** @var IInitialState */
private $initialState;

/** @var CapabilitiesService */
private $capabilitiesService;

/** @var IConfig */
private $config;

/** @var string|null */
private $userId;

/** @var bool */
private $hasProvidedCapabilities = false;
private bool $hasProvidedCapabilities = false;

public function __construct(
IInitialState $initialState,
CapabilitiesService $capabilitiesService,
IConfig $config,
$userId
private IInitialState $initialState,
private CapabilitiesService $capabilitiesService,
private IURLGenerator $urlGenerator,
private Defaults $themingDefaults,
private IConfig $config,
private ?string $userId,
) {
$this->initialState = $initialState;
$this->capabilitiesService = $capabilitiesService;
$this->config = $config;
$this->userId = $userId;
}

public function provideCapabilities(): void {
Expand All @@ -66,6 +53,7 @@ public function provideCapabilities(): void {
$this->initialState->provideInitialState('productName', $this->capabilitiesService->getProductName());
$this->initialState->provideInitialState('hasDrawSupport', $this->capabilitiesService->hasDrawSupport());
$this->initialState->provideInitialState('hasNextcloudBranding', $this->capabilitiesService->hasNextcloudBranding());
$this->initialState->provideInitialState('instanceid', $this->config->getSystemValue('instanceid'));

$this->provideOptions();

Expand Down Expand Up @@ -112,7 +100,7 @@ private function provideOptions(): void {
$logoSet = $this->config->getAppValue('theming', 'logoMime', '') !== '';
}
$this->initialState->provideInitialState('theming-customLogo', ($logoSet ?
\OC::$server->getURLGenerator()->getAbsoluteURL(\OC::$server->getThemingDefaults()->getLogo())
$this->urlGenerator->getAbsoluteURL($this->themingDefaults->getLogo())
: false));
}
}

0 comments on commit 40f63c1

Please sign in to comment.