chore: use consistent casing for header names (required by openAPI)

Signed-off-by: Ferdinand Thiessen <opensource@fthiessen.de>
pull/53393/head
Ferdinand Thiessen 7 months ago
parent e2f6b4ab83
commit 495c364268
No known key found for this signature in database
GPG Key ID: 45FAE7268762B400
  1. 2
      apps/files_sharing/lib/Controller/PublicPreviewController.php
  2. 4
      apps/files_sharing/tests/Controller/PublicPreviewControllerTest.php
  3. 6
      apps/webhook_listeners/lib/Controller/WebhooksController.php
  4. 2
      core/Controller/AppPasswordController.php
  5. 2
      core/Controller/ClientFlowLoginController.php
  6. 2
      core/Controller/ClientFlowLoginV2Controller.php
  7. 2
      core/Controller/PreviewController.php

@ -107,7 +107,7 @@ class PublicPreviewController extends PublicShareController {
$downloadForbidden = $attributes?->getAttribute('permissions', 'download') === false;
// Is this header is set it means our UI is doing a preview for no-download shares
// we check a header so we at least prevent people from using the link directly (obfuscation)
$isPublicPreview = $this->request->getHeader('X-NC-Preview') === 'true';
$isPublicPreview = $this->request->getHeader('x-nc-preview') === 'true';
if ($isPublicPreview && $downloadForbidden) {
// Only cache for 15 minutes on public preview requests to quickly remove from cache

@ -144,7 +144,7 @@ class PublicPreviewControllerTest extends TestCase {
->willReturn($attributes);
$this->request->method('getHeader')
->with('X-NC-Preview')
->with('x-nc-preview')
->willReturn('true');
$file = $this->createMock(File::class);
@ -184,7 +184,7 @@ class PublicPreviewControllerTest extends TestCase {
->willReturn($attributes);
$this->request->method('getHeader')
->with('X-NC-Preview')
->with('x-nc-preview')
->willReturn('true');
$file = $this->createMock(File::class);

@ -137,7 +137,7 @@ class WebhooksController extends OCSController {
): DataResponse {
$appId = null;
if ($this->session->get('app_api') === true) {
$appId = $this->request->getHeader('EX-APP-ID');
$appId = $this->request->getHeader('ex-app-id');
}
try {
$authMethod = AuthMethod::from($authMethod ?? AuthMethod::None->value);
@ -206,7 +206,7 @@ class WebhooksController extends OCSController {
): DataResponse {
$appId = null;
if ($this->session->get('app_api') === true) {
$appId = $this->request->getHeader('EX-APP-ID');
$appId = $this->request->getHeader('ex-app-id');
}
try {
$authMethod = AuthMethod::from($authMethod ?? AuthMethod::None->value);
@ -271,7 +271,7 @@ class WebhooksController extends OCSController {
/**
* Remove all existing webhook registration mapped to an AppAPI app id
*
* @param string $appid id of the app, as in the EX-APP-ID for creation
* @param string $appid id of the app, as in the ex-app-id for creation
*
* @return DataResponse<Http::STATUS_OK, int, array{}>
*

@ -77,7 +77,7 @@ class AppPasswordController extends OCSController {
$password = null;
}
$userAgent = $this->request->getHeader('USER_AGENT');
$userAgent = $this->request->getHeader('user-agent');
$token = $this->random->generate(72, ISecureRandom::CHAR_UPPER . ISecureRandom::CHAR_LOWER . ISecureRandom::CHAR_DIGITS);

@ -65,7 +65,7 @@ class ClientFlowLoginController extends Controller {
}
private function getClientName(): string {
$userAgent = $this->request->getHeader('USER_AGENT');
$userAgent = $this->request->getHeader('user-agent');
return $userAgent !== '' ? $userAgent : 'unknown';
}

@ -293,7 +293,7 @@ class ClientFlowLoginV2Controller extends Controller {
#[OpenAPI(scope: OpenAPI::SCOPE_DEFAULT)]
public function init(): JSONResponse {
// Get client user agent
$userAgent = $this->request->getHeader('USER_AGENT');
$userAgent = $this->request->getHeader('user-agent');
$tokens = $this->loginFlowV2Service->createTokens($userAgent);

@ -152,7 +152,7 @@ class PreviewController extends Controller {
// Is this header is set it means our UI is doing a preview for no-download shares
// we check a header so we at least prevent people from using the link directly (obfuscation)
$isNextcloudPreview = $this->request->getHeader('X-NC-Preview') === 'true';
$isNextcloudPreview = $this->request->getHeader('x-nc-preview') === 'true';
$storage = $node->getStorage();
if ($isNextcloudPreview === false && $storage->instanceOfStorage(ISharedStorage::class)) {
/** @var ISharedStorage $storage */

Loading…
Cancel
Save