From 9017fd463f3df7f4c04bc022ddcee474605b7e3e Mon Sep 17 00:00:00 2001 From: agobrech <45268029+agobrech@users.noreply.github.com> Date: Mon, 29 Aug 2022 15:28:17 +0200 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20Fix=20issue=20where=20the=20QS?= =?UTF-8?q?=20would=20be=20ignored=20(#3967)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/nodes-base/credentials/Aws.credentials.ts | 5 +++-- packages/nodes-base/nodes/Aws/S3/GenericFunctions.ts | 9 ++++++++- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/packages/nodes-base/credentials/Aws.credentials.ts b/packages/nodes-base/credentials/Aws.credentials.ts index 2e14789c16..ce4665c3a2 100644 --- a/packages/nodes-base/credentials/Aws.credentials.ts +++ b/packages/nodes-base/credentials/Aws.credentials.ts @@ -273,7 +273,7 @@ export class Aws implements ICredentialType { requestOptions: IHttpRequestOptions, ): Promise { let endpoint; - let service = requestOptions.qs?.service; + let service = requestOptions.qs?.service as string; let path = requestOptions.qs?.path; const method = requestOptions.method; const body = requestOptions.body; @@ -314,9 +314,10 @@ export class Aws implements ICredentialType { path = customUrl.pathname as string; endpoint = customUrl; } - if (service === 's3' && credentials.s3Endpoint) { + if (service.includes('.s3')) { path = `${endpoint.pathname}?${queryToString(query).replace(/\+/g, '%2B')}`; } + const signOpts = { headers: requestOptions.headers, host: endpoint.host, diff --git a/packages/nodes-base/nodes/Aws/S3/GenericFunctions.ts b/packages/nodes-base/nodes/Aws/S3/GenericFunctions.ts index ba29e6028a..5e431373d1 100644 --- a/packages/nodes-base/nodes/Aws/S3/GenericFunctions.ts +++ b/packages/nodes-base/nodes/Aws/S3/GenericFunctions.ts @@ -15,7 +15,13 @@ import { IWebhookFunctions, } from 'n8n-core'; -import { IDataObject, IHttpRequestOptions, JsonObject, NodeApiError, NodeOperationError } from 'n8n-workflow'; +import { + IDataObject, + IHttpRequestOptions, + JsonObject, + NodeApiError, + NodeOperationError, +} from 'n8n-workflow'; export async function awsApiRequest( this: IHookFunctions | IExecuteFunctions | ILoadOptionsFunctions | IWebhookFunctions, @@ -32,6 +38,7 @@ export async function awsApiRequest( const credentials = await this.getCredentials('aws'); const requestOptions = { qs: { + ...query, service, path, query,