Skip to content
Merged
Show file tree
Hide file tree
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
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ public function getPreview(
$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
Expand Down
2 changes: 1 addition & 1 deletion apps/files_sharing/openapi.json
Original file line number Diff line number Diff line change
Expand Up @@ -1492,7 +1492,7 @@
}
},
{
"name": "X-NC-Preview",
"name": "x-nc-preview",
"in": "header",
"schema": {
"type": "string"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ public function testShareNoDownloadButPreviewHeader() {
->willReturn($attributes);

$this->request->method('getHeader')
->with('X-NC-Preview')
->with('x-nc-preview')
->willReturn('true');

$file = $this->createMock(File::class);
Expand Down Expand Up @@ -184,7 +184,7 @@ public function testShareWithAttributes() {
->willReturn($attributes);

$this->request->method('getHeader')
->with('X-NC-Preview')
->with('x-nc-preview')
->willReturn('true');

$file = $this->createMock(File::class);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ public function create(
): 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);
Expand Down Expand Up @@ -206,7 +206,7 @@ public function update(
): 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);
Expand Down Expand Up @@ -271,7 +271,7 @@ public function destroy(int $id): DataResponse {
/**
* 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{}>
*
Expand Down
6 changes: 3 additions & 3 deletions apps/webhook_listeners/openapi.json
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,7 @@
},
"parameters": [
{
"name": "EX-APP-ID",
"name": "ex-app-id",
"in": "header",
"schema": {
"type": "string"
Expand Down Expand Up @@ -556,7 +556,7 @@
}
},
{
"name": "EX-APP-ID",
"name": "ex-app-id",
"in": "header",
"schema": {
"type": "string"
Expand Down Expand Up @@ -809,7 +809,7 @@
{
"name": "appid",
"in": "path",
"description": "id of the app, as in the EX-APP-ID for creation",
"description": "id of the app, as in the ex-app-id for creation",
"required": true,
"schema": {
"type": "string"
Expand Down
2 changes: 1 addition & 1 deletion core/Controller/AppPasswordController.php
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ public function getAppPassword(): DataResponse {
$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);

Expand Down
2 changes: 1 addition & 1 deletion core/Controller/ClientFlowLoginController.php
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ public function __construct(
}

private function getClientName(): string {
$userAgent = $this->request->getHeader('USER_AGENT');
$userAgent = $this->request->getHeader('user-agent');
return $userAgent !== '' ? $userAgent : 'unknown';
}

Expand Down
2 changes: 1 addition & 1 deletion core/Controller/ClientFlowLoginV2Controller.php
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,7 @@ private function handleFlowDone(bool $result): StandaloneTemplateResponse {
#[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);

Expand Down
2 changes: 1 addition & 1 deletion core/Controller/PreviewController.php
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ private function fetchPreview(

// 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 */
Expand Down
4 changes: 2 additions & 2 deletions core/openapi-full.json
Original file line number Diff line number Diff line change
Expand Up @@ -1173,7 +1173,7 @@
],
"parameters": [
{
"name": "USER_AGENT",
"name": "user-agent",
"in": "header",
"schema": {
"type": "string"
Expand Down Expand Up @@ -8066,7 +8066,7 @@
],
"parameters": [
{
"name": "USER_AGENT",
"name": "user-agent",
"in": "header",
"schema": {
"type": "string"
Expand Down
4 changes: 2 additions & 2 deletions core/openapi.json
Original file line number Diff line number Diff line change
Expand Up @@ -1173,7 +1173,7 @@
],
"parameters": [
{
"name": "USER_AGENT",
"name": "user-agent",
"in": "header",
"schema": {
"type": "string"
Expand Down Expand Up @@ -8066,7 +8066,7 @@
],
"parameters": [
{
"name": "USER_AGENT",
"name": "user-agent",
"in": "header",
"schema": {
"type": "string"
Expand Down
12 changes: 6 additions & 6 deletions openapi.json
Original file line number Diff line number Diff line change
Expand Up @@ -4645,7 +4645,7 @@
],
"parameters": [
{
"name": "USER_AGENT",
"name": "user-agent",
"in": "header",
"schema": {
"type": "string"
Expand Down Expand Up @@ -11585,7 +11585,7 @@
],
"parameters": [
{
"name": "USER_AGENT",
"name": "user-agent",
"in": "header",
"schema": {
"type": "string"
Expand Down Expand Up @@ -19842,7 +19842,7 @@
}
},
{
"name": "X-NC-Preview",
"name": "x-nc-preview",
"in": "header",
"schema": {
"type": "string"
Expand Down Expand Up @@ -30808,7 +30808,7 @@
},
"parameters": [
{
"name": "EX-APP-ID",
"name": "ex-app-id",
"in": "header",
"schema": {
"type": "string"
Expand Down Expand Up @@ -31108,7 +31108,7 @@
}
},
{
"name": "EX-APP-ID",
"name": "ex-app-id",
"in": "header",
"schema": {
"type": "string"
Expand Down Expand Up @@ -31361,7 +31361,7 @@
{
"name": "appid",
"in": "path",
"description": "id of the app, as in the EX-APP-ID for creation",
"description": "id of the app, as in the ex-app-id for creation",
"required": true,
"schema": {
"type": "string"
Expand Down
4 changes: 2 additions & 2 deletions tests/Core/Controller/AppPasswordControllerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ public function testGetAppPassword(): void {
$credentials->method('getLoginName')
->willReturn('myLoginName');
$this->request->method('getHeader')
->with('USER_AGENT')
->with('user-agent')
->willReturn('myUA');
$this->random->method('generate')
->with(
Expand Down Expand Up @@ -164,7 +164,7 @@ public function testGetAppPasswordNoPassword(): void {
$credentials->method('getLoginName')
->willReturn('myLoginName');
$this->request->method('getHeader')
->with('USER_AGENT')
->with('user-agent')
->willReturn('myUA');
$this->random->method('generate')
->with(
Expand Down
14 changes: 7 additions & 7 deletions tests/Core/Controller/ClientFlowLoginControllerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ public function testShowAuthPickerPageWithOcsHeader(): void {
$this->request
->method('getHeader')
->willReturnMap([
['USER_AGENT', 'Mac OS X Sync Client'],
['user-agent', 'Mac OS X Sync Client'],
['OCS-APIREQUEST', 'true'],
]);
$this->random
Expand Down Expand Up @@ -178,7 +178,7 @@ public function testShowAuthPickerPageWithOauth(): void {
$this->request
->method('getHeader')
->willReturnMap([
['USER_AGENT', 'Mac OS X Sync Client'],
['user-agent', 'Mac OS X Sync Client'],
['OCS-APIREQUEST', 'false'],
]);
$client = new Client();
Expand Down Expand Up @@ -555,7 +555,7 @@ public static function dataGeneratePasswordWithHttpsProxy(): array {
[
['X-Forwarded-Proto', 'http'],
['X-Forwarded-Ssl', 'off'],
['USER_AGENT', ''],
['user-agent', ''],
],
'http',
'http',
Expand All @@ -564,7 +564,7 @@ public static function dataGeneratePasswordWithHttpsProxy(): array {
[
['X-Forwarded-Proto', 'http'],
['X-Forwarded-Ssl', 'off'],
['USER_AGENT', ''],
['user-agent', ''],
],
'https',
'https',
Expand All @@ -573,7 +573,7 @@ public static function dataGeneratePasswordWithHttpsProxy(): array {
[
['X-Forwarded-Proto', 'https'],
['X-Forwarded-Ssl', 'off'],
['USER_AGENT', ''],
['user-agent', ''],
],
'http',
'https',
Expand All @@ -582,7 +582,7 @@ public static function dataGeneratePasswordWithHttpsProxy(): array {
[
['X-Forwarded-Proto', 'https'],
['X-Forwarded-Ssl', 'on'],
['USER_AGENT', ''],
['user-agent', ''],
],
'http',
'https',
Expand All @@ -591,7 +591,7 @@ public static function dataGeneratePasswordWithHttpsProxy(): array {
[
['X-Forwarded-Proto', 'http'],
['X-Forwarded-Ssl', 'on'],
['USER_AGENT', ''],
['user-agent', ''],
],
'http',
'https',
Expand Down
2 changes: 1 addition & 1 deletion tests/Core/Controller/PreviewControllerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,7 @@ public function testFileWithoutDownloadPermissionButHeader() {

$this->request
->method('getHeader')
->with('X-NC-Preview')
->with('x-nc-preview')
->willReturn('true');

$preview = $this->createMock(ISimpleFile::class);
Expand Down
24 changes: 12 additions & 12 deletions vendor-bin/openapi-extractor/composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading