Skip to content

Commit 7e64ab0

Browse files
authored
Merge pull request #862 from nextcloud/chore/code-simplification-stable32
[stable32] refactor: simplify enabled-state check in validateExAppRequestToNC
2 parents 3ee00b1 + bae450b commit 7e64ab0

1 file changed

Lines changed: 9 additions & 11 deletions

File tree

lib/Service/AppAPIService.php

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -301,17 +301,15 @@ public function validateExAppRequestToNC(IRequest $request, bool $isDav = false)
301301
$authValid = $authorizationSecret === $exApp->getSecret();
302302

303303
if ($authValid) {
304-
if (!$isDav) {
305-
try {
306-
$path = $request->getPathInfo();
307-
} catch (\Exception $e) {
308-
$this->logger->error(sprintf('Error getting path info. Error: %s', $e->getMessage()), ['exception' => $e]);
309-
return false;
310-
}
311-
if (($this->sanitizeOcsRoute($path) !== '/apps/app_api/ex-app/state') && !$exApp->getEnabled()) {
312-
$this->logger->error(sprintf('ExApp with appId %s is disabled (%s)', $request->getHeader('EX-APP-ID'), $request->getRequestUri()));
313-
return false;
314-
}
304+
try {
305+
$path = $request->getPathInfo();
306+
} catch (\Exception $e) {
307+
$this->logger->error(sprintf('Error getting path info. Error: %s', $e->getMessage()), ['exception' => $e]);
308+
return false;
309+
}
310+
if (($this->sanitizeOcsRoute($path) !== '/apps/app_api/ex-app/state') && !$exApp->getEnabled()) {
311+
$this->logger->error(sprintf('ExApp with appId %s is disabled (%s)', $request->getHeader('EX-APP-ID'), $request->getRequestUri()));
312+
return false;
315313
}
316314
if (!$this->handleExAppVersionChange($request, $exApp)) {
317315
return false;

0 commit comments

Comments
 (0)