cynx-lib 1.3.39 → 1.3.40

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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cynx-lib",
3
- "version": "1.3.39",
3
+ "version": "1.3.40",
4
4
  "type": "module",
5
5
  "main": "./index.js",
6
6
  "bin": {
@@ -375,7 +375,11 @@ export class StorageManager {
375
375
  },
376
376
  };
377
377
  if (endpoint && endpoint.trim()) {
378
- clientOpts.endpoint = endpoint.trim();
378
+ let cleanEndpoint = endpoint.trim().replace(/\/+$/, '');
379
+ if (!/^https?:\/\//i.test(cleanEndpoint)) {
380
+ cleanEndpoint = `https://${cleanEndpoint}`;
381
+ }
382
+ clientOpts.endpoint = cleanEndpoint;
379
383
  clientOpts.forcePathStyle = true;
380
384
  }
381
385
  return new S3Client(clientOpts);
@@ -647,6 +651,10 @@ export class StorageManager {
647
651
  let base = publicDomain.trim().replace(/\/+$/, '');
648
652
  if (!/^https?:\/\//i.test(base)) base = `https://${base}`;
649
653
  cloudUrl = `${base}/${objectKey}`;
654
+ } else if (endpoint && endpoint.trim()) {
655
+ let base = endpoint.trim().replace(/\/+$/, '');
656
+ if (!/^https?:\/\//i.test(base)) base = `https://${base}`;
657
+ cloudUrl = `${base}/${bucket.trim()}/${objectKey}`;
650
658
  } else if (provider === 's3') {
651
659
  const reg = region ? region.trim() : 'us-east-1';
652
660
  cloudUrl = `https://${bucket.trim()}.s3.${reg}.amazonaws.com/${objectKey}`;