@uploadcare/upload-client 6.2.0 → 6.2.1

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.
@@ -390,7 +390,7 @@ const getUrl = (base, path, query) => {
390
390
  return url.toString();
391
391
  };
392
392
 
393
- var version = '6.2.0';
393
+ var version = '6.2.1';
394
394
 
395
395
  const LIBRARY_NAME = 'UploadcareUploadClient';
396
396
  const LIBRARY_VERSION = version;
@@ -781,7 +781,7 @@ function isReadyPoll({ file, publicKey, baseURL, source, integration, userAgent,
781
781
  }
782
782
 
783
783
  class UploadcareFile {
784
- constructor(fileInfo, { baseCDN, fileName }) {
784
+ constructor(fileInfo, { baseCDN = defaultSettings.baseCDN, fileName } = {}) {
785
785
  this.name = null;
786
786
  this.size = null;
787
787
  this.isStored = null;
@@ -796,9 +796,9 @@ class UploadcareFile {
796
796
  this.metadata = null;
797
797
  this.s3Bucket = null;
798
798
  const { uuid, s3Bucket } = fileInfo;
799
- const cdnUrl = `${baseCDN}/${uuid}/`;
799
+ const cdnUrl = getUrl(baseCDN, `${uuid}/`);
800
800
  const s3Url = s3Bucket
801
- ? `https://${s3Bucket}.s3.amazonaws.com/${uuid}/${fileInfo.filename}`
801
+ ? getUrl(`https://${s3Bucket}.s3.amazonaws.com/`, `${uuid}/${fileInfo.filename}`)
802
802
  : null;
803
803
  this.uuid = uuid;
804
804
  this.name = fileName || fileInfo.filename;
package/dist/index.d.ts CHANGED
@@ -363,7 +363,7 @@ export declare class UploadcareFile {
363
363
  readonly contentInfo: null | ContentInfo;
364
364
  readonly metadata: null | Metadata;
365
365
  readonly s3Bucket: null | string;
366
- constructor(fileInfo: FileInfo, { baseCDN, fileName }: {
366
+ constructor(fileInfo: FileInfo, { baseCDN, fileName }?: {
367
367
  baseCDN?: string;
368
368
  fileName?: string;
369
369
  });
@@ -418,7 +418,7 @@ const getUrl = (base, path, query) => {
418
418
  return url.toString();
419
419
  };
420
420
 
421
- var version = '6.2.0';
421
+ var version = '6.2.1';
422
422
 
423
423
  const LIBRARY_NAME = 'UploadcareUploadClient';
424
424
  const LIBRARY_VERSION = version;
@@ -809,7 +809,7 @@ function isReadyPoll({ file, publicKey, baseURL, source, integration, userAgent,
809
809
  }
810
810
 
811
811
  class UploadcareFile {
812
- constructor(fileInfo, { baseCDN, fileName }) {
812
+ constructor(fileInfo, { baseCDN = defaultSettings.baseCDN, fileName } = {}) {
813
813
  this.name = null;
814
814
  this.size = null;
815
815
  this.isStored = null;
@@ -824,9 +824,9 @@ class UploadcareFile {
824
824
  this.metadata = null;
825
825
  this.s3Bucket = null;
826
826
  const { uuid, s3Bucket } = fileInfo;
827
- const cdnUrl = `${baseCDN}/${uuid}/`;
827
+ const cdnUrl = getUrl(baseCDN, `${uuid}/`);
828
828
  const s3Url = s3Bucket
829
- ? `https://${s3Bucket}.s3.amazonaws.com/${uuid}/${fileInfo.filename}`
829
+ ? getUrl(`https://${s3Bucket}.s3.amazonaws.com/`, `${uuid}/${fileInfo.filename}`)
830
830
  : null;
831
831
  this.uuid = uuid;
832
832
  this.name = fileName || fileInfo.filename;
@@ -398,7 +398,7 @@ const getUrl = (base, path, query) => {
398
398
  return url.toString();
399
399
  };
400
400
 
401
- var version = '6.2.0';
401
+ var version = '6.2.1';
402
402
 
403
403
  const LIBRARY_NAME = 'UploadcareUploadClient';
404
404
  const LIBRARY_VERSION = version;
@@ -789,7 +789,7 @@ function isReadyPoll({ file, publicKey, baseURL, source, integration, userAgent,
789
789
  }
790
790
 
791
791
  class UploadcareFile {
792
- constructor(fileInfo, { baseCDN, fileName }) {
792
+ constructor(fileInfo, { baseCDN = defaultSettings.baseCDN, fileName } = {}) {
793
793
  this.name = null;
794
794
  this.size = null;
795
795
  this.isStored = null;
@@ -804,9 +804,9 @@ class UploadcareFile {
804
804
  this.metadata = null;
805
805
  this.s3Bucket = null;
806
806
  const { uuid, s3Bucket } = fileInfo;
807
- const cdnUrl = `${baseCDN}/${uuid}/`;
807
+ const cdnUrl = getUrl(baseCDN, `${uuid}/`);
808
808
  const s3Url = s3Bucket
809
- ? `https://${s3Bucket}.s3.amazonaws.com/${uuid}/${fileInfo.filename}`
809
+ ? getUrl(`https://${s3Bucket}.s3.amazonaws.com/`, `${uuid}/${fileInfo.filename}`)
810
810
  : null;
811
811
  this.uuid = uuid;
812
812
  this.name = fileName || fileInfo.filename;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@uploadcare/upload-client",
3
- "version": "6.2.0",
3
+ "version": "6.2.1",
4
4
  "description": "Library for work with Uploadcare Upload API",
5
5
  "type": "module",
6
6
  "module": "./dist/index.node.js",
@@ -78,7 +78,7 @@
78
78
  "koa-body": "5.0.0",
79
79
  "mock-socket": "9.0.3",
80
80
  "start-server-and-test": "1.14.0",
81
- "@uploadcare/api-client-utils": "^6.2.0",
81
+ "@uploadcare/api-client-utils": "^6.2.1",
82
82
  "chalk": "^4.1.2"
83
83
  },
84
84
  "dependencies": {