In
|
validateAssetForURLCreation(): void { |
|
if (typeof this.cloudName === 'undefined') { |
|
throw 'You must supply a cloudName when initializing the asset'; |
|
} |
|
|
|
const suffixContainsDot = this.suffix && this.suffix.indexOf('.') >= 0; |
|
const suffixContainsSlash = this.suffix && this.suffix.indexOf('/') >= 0; |
|
|
|
if (suffixContainsDot || suffixContainsSlash) { |
|
throw '`suffix`` should not include . or /'; |
|
} |
|
} |
a
cloudName setting is explicitly required. However, in
|
function getUrlPrefix(cloudName: string, urlConfig: IURLConfig): string { |
|
const secure = urlConfig.secure; |
|
const privateCDN = urlConfig.privateCdn; |
|
const cname = urlConfig.cname; |
|
const secureDistribution = urlConfig.secureDistribution; |
|
|
|
if (!secure && !cname) { |
|
return `http://res.cloudinary.com/${cloudName}`; |
|
} |
|
|
|
if (secure && !secureDistribution && privateCDN) { |
|
return `https://${cloudName}-res.cloudinary.com`; |
|
} |
|
|
|
if (secure && !secureDistribution) { |
|
return `https://res.cloudinary.com/${cloudName}`; |
|
} |
|
|
|
if (secure && secureDistribution && privateCDN) { |
|
return `https://${secureDistribution}`; |
|
} |
|
|
|
if (secure && secureDistribution) { |
|
return `https://${secureDistribution}/${cloudName}`; |
|
} |
|
|
|
if (!secure && cname) { |
|
return `http://${cname}/${cloudName}`; |
|
} else { |
|
return 'ERROR'; |
|
} |
|
} |
the
cloudName isn't actually even utilized if using a
secureDistribution and
privateCDN.
The check for cloudName should be moved into getUrlPrefix and we should only throw when omitting the cloud name for branches where it's actually utilized.
In
js-url-gen/src/assets/CloudinaryFile.ts
Lines 182 to 193 in e1b9719
cloudNamesetting is explicitly required. However, injs-url-gen/src/internal/url/cloudinaryURL.ts
Lines 20 to 51 in e1b9719
cloudNameisn't actually even utilized if using asecureDistributionandprivateCDN.The check for
cloudNameshould be moved intogetUrlPrefixand we should only throw when omitting the cloud name for branches where it's actually utilized.