mirror of
https://github.com/n8n-io/n8n.git
synced 2024-12-24 20:24:05 -08:00
fix(AwsS3 Node): Fix handling of bucket with dot in name (#8475)
This commit is contained in:
parent
e643a126f4
commit
0febe62ad0
|
@ -300,7 +300,7 @@ export class AwsS3V2 implements INodeType {
|
|||
headers['x-amz-request-payer'] = 'requester';
|
||||
}
|
||||
if (additionalFields.parentFolderKey) {
|
||||
path = `/${additionalFields.parentFolderKey}${folderName}/`;
|
||||
path = `${basePath}/${additionalFields.parentFolderKey}/${folderName}/`;
|
||||
}
|
||||
if (additionalFields.storageClass) {
|
||||
headers['x-amz-storage-class'] = snakeCase(
|
||||
|
@ -778,7 +778,7 @@ export class AwsS3V2 implements INodeType {
|
|||
const additionalFields = this.getNodeParameter('additionalFields', i);
|
||||
const tagsValues = (this.getNodeParameter('tagsUi', i) as IDataObject)
|
||||
.tagsValues as IDataObject[];
|
||||
let path = `${basePath}/`;
|
||||
let path = `${basePath}/${fileName}`;
|
||||
let body;
|
||||
|
||||
const multipartHeaders: IDataObject = {};
|
||||
|
@ -788,9 +788,7 @@ export class AwsS3V2 implements INodeType {
|
|||
neededHeaders['x-amz-request-payer'] = 'requester';
|
||||
}
|
||||
if (additionalFields.parentFolderKey) {
|
||||
path = `${additionalFields.parentFolderKey}/${fileName}`;
|
||||
} else {
|
||||
path = `${fileName}`;
|
||||
path = `${basePath}/${additionalFields.parentFolderKey}/${fileName}`;
|
||||
}
|
||||
if (additionalFields.storageClass) {
|
||||
multipartHeaders['x-amz-storage-class'] = snakeCase(
|
||||
|
@ -877,7 +875,7 @@ export class AwsS3V2 implements INodeType {
|
|||
this,
|
||||
servicePath,
|
||||
'POST',
|
||||
`/${path}?uploads`,
|
||||
`${path}?uploads`,
|
||||
body,
|
||||
qs,
|
||||
{ ...neededHeaders, ...multipartHeaders },
|
||||
|
@ -899,7 +897,7 @@ export class AwsS3V2 implements INodeType {
|
|||
this,
|
||||
servicePath,
|
||||
'PUT',
|
||||
`/${path}?partNumber=${part}&uploadId=${uploadId}`,
|
||||
`${path}?partNumber=${part}&uploadId=${uploadId}`,
|
||||
chunk,
|
||||
qs,
|
||||
listHeaders,
|
||||
|
@ -913,7 +911,7 @@ export class AwsS3V2 implements INodeType {
|
|||
this,
|
||||
servicePath,
|
||||
'DELETE',
|
||||
`/${path}?uploadId=${uploadId}`,
|
||||
`${path}?uploadId=${uploadId}`,
|
||||
);
|
||||
} catch (err) {
|
||||
throw new NodeOperationError(this.getNode(), err as Error);
|
||||
|
@ -926,7 +924,7 @@ export class AwsS3V2 implements INodeType {
|
|||
this,
|
||||
servicePath,
|
||||
'GET',
|
||||
`/${path}?max-parts=${900}&part-number-marker=0&uploadId=${uploadId}`,
|
||||
`${path}?max-parts=${900}&part-number-marker=0&uploadId=${uploadId}`,
|
||||
'',
|
||||
qs,
|
||||
{ ...neededHeaders },
|
||||
|
@ -978,7 +976,7 @@ export class AwsS3V2 implements INodeType {
|
|||
this,
|
||||
servicePath,
|
||||
'POST',
|
||||
`/${path}?uploadId=${uploadId}`,
|
||||
`${path}?uploadId=${uploadId}`,
|
||||
data,
|
||||
qs,
|
||||
{
|
||||
|
@ -1015,7 +1013,7 @@ export class AwsS3V2 implements INodeType {
|
|||
this,
|
||||
servicePath,
|
||||
'PUT',
|
||||
`/${path || binaryPropertyData.fileName}`,
|
||||
path,
|
||||
body,
|
||||
qs,
|
||||
headers,
|
||||
|
@ -1043,7 +1041,7 @@ export class AwsS3V2 implements INodeType {
|
|||
this,
|
||||
servicePath,
|
||||
'PUT',
|
||||
`/${path}`,
|
||||
path,
|
||||
body,
|
||||
qs,
|
||||
{ ...headers },
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
{
|
||||
"parameters": {
|
||||
"operation": "upload",
|
||||
"bucketName": "bucket",
|
||||
"bucketName": "buc.ket",
|
||||
"fileName": "binary.json",
|
||||
"additionalFields": {}
|
||||
},
|
||||
|
|
|
@ -14,11 +14,11 @@ describe('Test S3 V2 Node', () => {
|
|||
await initBinaryDataService();
|
||||
|
||||
nock.disableNetConnect();
|
||||
mock = nock('https://bucket.s3.eu-central-1.amazonaws.com');
|
||||
mock = nock('https://s3.eu-central-1.amazonaws.com/buc.ket');
|
||||
});
|
||||
|
||||
beforeEach(async () => {
|
||||
mock.get('/?location').reply(
|
||||
mock.get('?location').reply(
|
||||
200,
|
||||
`<?xml version="1.0" encoding="UTF-8"?>
|
||||
<LocationConstraint>
|
||||
|
|
Loading…
Reference in a new issue