Skip to content

Commit

Permalink
minor fixes
Browse files Browse the repository at this point in the history
Signed-off-by: Andrey Borysenko <[email protected]>
  • Loading branch information
andrey18106 committed Nov 8, 2023
1 parent ba0923e commit 4015d06
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions lib/Service/AppAPIService.php
Original file line number Diff line number Diff line change
Expand Up @@ -416,8 +416,6 @@ public function dispatchExAppInit(ExApp $exApp): void {
) . '/init';

$options = [
'Accept' => 'application/json',
'Content-Type' => 'application/json',
'headers' => $this->buildAppAPIAuthHeaders(null, null, $exApp),
'nextcloud' => [
'allow_local_address' => true,
Expand Down Expand Up @@ -572,7 +570,7 @@ public function aeRequestToExAppById(
* Request to ExApp by appId with AppAPI auth headers
*
* @param IRequest|null $request
* @param string $userId
* @param string|null $userId
* @param string $appId
* @param string $route
* @param string $method
Expand All @@ -583,7 +581,7 @@ public function aeRequestToExAppById(
*/
public function requestToExAppById(
?IRequest $request,
string $userId,
?string $userId,
string $appId,
string $route,
string $method = 'POST',
Expand Down Expand Up @@ -626,7 +624,11 @@ public function requestToExApp(
$exApp->getHost(),
$exApp->getPort()) . $route;

$options['headers'] = isset($options['headers']) ? [...$options['headers'], $this->buildAppAPIAuthHeaders($request, $userId, $exApp)] : $this->buildAppAPIAuthHeaders($request, $userId, $exApp);
if (is_array($options['headers'])) {
$options['headers'] = [...$options['headers'], $this->buildAppAPIAuthHeaders($request, $userId, $exApp)];
} else {
$options['headers'] = $this->buildAppAPIAuthHeaders($request, $userId, $exApp);
}
$options['nextcloud'] = [
'allow_local_address' => true, // it's required as we are using ExApp appid as hostname (usually local)
];
Expand Down

0 comments on commit 4015d06

Please sign in to comment.