cynx-lib 1.3.40 → 1.3.41
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.
package/package.json
CHANGED
|
@@ -367,18 +367,25 @@ export class StorageManager {
|
|
|
367
367
|
if (!region || !accessKeyId || !secretAccessKey) {
|
|
368
368
|
throw new Error('Неполные данные подключения Amazon S3 (Region, Access Key ID, Secret Access Key)');
|
|
369
369
|
}
|
|
370
|
+
const reg = (region && region.trim() && region.trim().toLowerCase() !== 'auto') ? region.trim() : 'us-east-1';
|
|
370
371
|
const clientOpts = {
|
|
371
|
-
region:
|
|
372
|
+
region: reg,
|
|
372
373
|
credentials: {
|
|
373
374
|
accessKeyId: accessKeyId.trim(),
|
|
374
375
|
secretAccessKey: secretAccessKey.trim(),
|
|
375
376
|
},
|
|
376
377
|
};
|
|
377
378
|
if (endpoint && endpoint.trim()) {
|
|
378
|
-
let cleanEndpoint = endpoint.trim()
|
|
379
|
+
let cleanEndpoint = endpoint.trim();
|
|
379
380
|
if (!/^https?:\/\//i.test(cleanEndpoint)) {
|
|
380
381
|
cleanEndpoint = `https://${cleanEndpoint}`;
|
|
381
382
|
}
|
|
383
|
+
try {
|
|
384
|
+
const parsed = new URL(cleanEndpoint);
|
|
385
|
+
cleanEndpoint = parsed.origin;
|
|
386
|
+
} catch {
|
|
387
|
+
cleanEndpoint = cleanEndpoint.replace(/\/+$/, '');
|
|
388
|
+
}
|
|
382
389
|
clientOpts.endpoint = cleanEndpoint;
|
|
383
390
|
clientOpts.forcePathStyle = true;
|
|
384
391
|
}
|