Skip to content
Merged
Changes from all commits
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
17 changes: 2 additions & 15 deletions lib/Service/AppAPIService.php
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ private function prepareRequestToExApp(

if ((!array_key_exists('multipart', $options)) && (count($params)) > 0) {
if ($method === 'GET') {
$url .= '?' . $this->getUriEncodedParams($params);
$url .= '?' . http_build_query($params);
} else {
$options['json'] = $params;
}
Expand Down Expand Up @@ -231,7 +231,7 @@ private function prepareRequestToExApp2(

if ((!array_key_exists('multipart', $options))) {
if (count($queryParams) > 0) {
$url .= '?' . $this->getUriEncodedParams($queryParams);
$url .= '?' . http_build_query($queryParams);
}
if ($method !== 'GET' && count($bodyParams) > 0) {
$options['json'] = $bodyParams;
Expand All @@ -258,19 +258,6 @@ private function swapAuthorizationHeader(array $headers): array {
return $headers;
}

private function getUriEncodedParams(array $params): string {
$paramsContent = '';
foreach ($params as $key => $value) {
if (is_array($value)) {
foreach ($value as $oneArrayValue) {
$paramsContent .= $key . '[]=' . urlencode($oneArrayValue) . '&';
}
unset($params[$key]);
}
}
return $paramsContent . http_build_query($params);
}

/**
* AppAPI authentication request validation for Nextcloud:
* - checks if ExApp exists and is enabled
Expand Down