n8n-nodes-binary-to-url 0.0.7 → 0.0.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -4,43 +4,50 @@ exports.S3Api = void 0;
|
|
|
4
4
|
class S3Api {
|
|
5
5
|
constructor() {
|
|
6
6
|
this.name = 's3Api';
|
|
7
|
-
this.displayName = 'S3
|
|
7
|
+
this.displayName = 'S3';
|
|
8
8
|
this.icon = 'file:../icons/BinaryToUrl.svg';
|
|
9
9
|
this.documentationUrl = 'https://docs.aws.amazon.com/AmazonS3/latest/userguide/AccessCredentials.html';
|
|
10
10
|
this.properties = [
|
|
11
11
|
{
|
|
12
|
-
displayName: '
|
|
13
|
-
name: '
|
|
14
|
-
type: 'string',
|
|
15
|
-
typeOptions: { password: true },
|
|
16
|
-
default: '',
|
|
17
|
-
},
|
|
18
|
-
{
|
|
19
|
-
displayName: 'Secret Access Key',
|
|
20
|
-
name: 'secretAccessKey',
|
|
12
|
+
displayName: 'S3 Endpoint',
|
|
13
|
+
name: 'endpoint',
|
|
21
14
|
type: 'string',
|
|
22
|
-
typeOptions: { password: true },
|
|
23
15
|
default: '',
|
|
16
|
+
description: 'S3-compatible service endpoint (e.g., https://s3.amazonaws.com, https://minio.example.com)',
|
|
24
17
|
},
|
|
25
18
|
{
|
|
26
19
|
displayName: 'Region',
|
|
27
20
|
name: 'region',
|
|
28
21
|
type: 'string',
|
|
29
22
|
default: 'us-east-1',
|
|
30
|
-
description: 'AWS region
|
|
23
|
+
description: 'AWS region or custom region for S3-compatible service',
|
|
31
24
|
},
|
|
32
25
|
{
|
|
33
|
-
displayName: '
|
|
34
|
-
name: '
|
|
26
|
+
displayName: 'Access Key ID',
|
|
27
|
+
name: 'accessKeyId',
|
|
28
|
+
type: 'string',
|
|
29
|
+
default: '',
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
displayName: 'Secret Access Key',
|
|
33
|
+
name: 'secretAccessKey',
|
|
35
34
|
type: 'string',
|
|
36
35
|
default: '',
|
|
37
|
-
|
|
38
|
-
|
|
36
|
+
typeOptions: {
|
|
37
|
+
password: true,
|
|
38
|
+
},
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
displayName: 'Force Path Style',
|
|
42
|
+
name: 'forcePathStyle',
|
|
43
|
+
type: 'boolean',
|
|
44
|
+
default: false,
|
|
45
|
+
description: 'Use path-style addressing (required for MinIO, DigitalOcean Spaces, etc.)',
|
|
39
46
|
},
|
|
40
47
|
];
|
|
41
48
|
this.test = {
|
|
42
49
|
request: {
|
|
43
|
-
baseURL: '={{$credentials.
|
|
50
|
+
baseURL: '={{$credentials.endpoint}}',
|
|
44
51
|
url: '=/',
|
|
45
52
|
method: 'GET',
|
|
46
53
|
},
|
package/dist/drivers/index.js
CHANGED
|
@@ -17,20 +17,23 @@ async function createStorageDriver(context, bucket) {
|
|
|
17
17
|
const creds = credentials;
|
|
18
18
|
const accessKeyId = creds.accessKeyId || '';
|
|
19
19
|
const secretAccessKey = creds.secretAccessKey || '';
|
|
20
|
-
const credentialEndpoint = creds.
|
|
20
|
+
const credentialEndpoint = creds.endpoint;
|
|
21
21
|
const credentialRegion = creds.region;
|
|
22
|
-
//
|
|
22
|
+
// Convert forcePathStyle from credential (could be string or boolean)
|
|
23
|
+
const credentialForcePathStyle = String(creds.forcePathStyle) === 'true';
|
|
24
|
+
// Use credential values if node parameters are empty
|
|
23
25
|
const finalEndpoint = endpoint || credentialEndpoint;
|
|
24
|
-
// Use credential region if node parameter is empty
|
|
25
26
|
const finalRegion = region || credentialRegion || 'us-east-1';
|
|
27
|
+
// Use boolean OR to combine forcePathStyle from node and credential
|
|
28
|
+
const finalForcePathStyle = forcePathStyle || credentialForcePathStyle || false;
|
|
26
29
|
if (!accessKeyId || !secretAccessKey) {
|
|
27
30
|
throw new Error('Invalid credentials. Missing access key or secret key.');
|
|
28
31
|
}
|
|
29
32
|
// Auto-determine if path style should be forced
|
|
30
|
-
let shouldForcePathStyle =
|
|
33
|
+
let shouldForcePathStyle = finalForcePathStyle;
|
|
31
34
|
// Force path style by default if custom endpoint is provided
|
|
32
35
|
// This is needed for MinIO, Wasabi, DigitalOcean Spaces, Alibaba OSS, Tencent COS, etc.
|
|
33
|
-
if (finalEndpoint && finalEndpoint !== '') {
|
|
36
|
+
if (finalEndpoint && finalEndpoint !== '' && !finalForcePathStyle) {
|
|
34
37
|
shouldForcePathStyle = true;
|
|
35
38
|
}
|
|
36
39
|
const config = {
|