Skip to content

Commit

Permalink
Version 1.38.0
Browse files Browse the repository at this point in the history
  • Loading branch information
cloudinary-bot committed Jul 20, 2023
1 parent e0c9bb2 commit 262d690
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 21 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
1.38.0 / 2023-07-20
==================

* feat: new method to_url added to support cached search feature

1.37.3 / 2023-06-26
==================

Expand Down
27 changes: 8 additions & 19 deletions lib-es5/utils/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -792,15 +792,18 @@ function patchFetchFormat() {
}
}

function build_distribution_domain(options) {
var source = consumeOption(options, 'source', '');
function build_distribution_domain(source, options) {
var cloud_name = consumeOption(options, 'cloud_name', config().cloud_name);

if (!cloud_name) {
throw new Error('Must supply cloud_name in tag or in configuration');
}

var secure = consumeOption(options, 'secure', config().secure);
var secure = consumeOption(options, 'secure', null);
var ssl_detected = consumeOption(options, 'ssl_detected', config().ssl_detected);
if (secure === null) {
secure = ssl_detected || config().secure;
}

var private_cdn = consumeOption(options, 'private_cdn', config().private_cdn);
var cname = consumeOption(options, 'cname', config().cname);
var secure_distribution = consumeOption(options, 'secure_distribution', config().secure_distribution);
Expand All @@ -827,20 +830,6 @@ function url(public_id) {
}
var long_url_signature = !!consumeOption(options, "long_url_signature", config().long_url_signature);
var format = consumeOption(options, "format");
var cloud_name = consumeOption(options, "cloud_name", config().cloud_name);
if (!cloud_name) {
throw "Unknown cloud_name";
}
var private_cdn = consumeOption(options, "private_cdn", config().private_cdn);
var secure_distribution = consumeOption(options, "secure_distribution", config().secure_distribution);
var secure = consumeOption(options, "secure", null);
var ssl_detected = consumeOption(options, "ssl_detected", config().ssl_detected);
if (secure === null) {
secure = ssl_detected || config().secure;
}
var cdn_subdomain = consumeOption(options, "cdn_subdomain", config().cdn_subdomain);
var secure_cdn_subdomain = consumeOption(options, "secure_cdn_subdomain", config().secure_cdn_subdomain);
var cname = consumeOption(options, "cname", config().cname);
var shorten = consumeOption(options, "shorten", config().shorten);
var sign_url = consumeOption(options, "sign_url", config().sign_url);
var api_secret = consumeOption(options, "api_secret", config().api_secret);
Expand Down Expand Up @@ -909,7 +898,7 @@ function url(public_id) {
signature = hash.replace(/\//g, '_').replace(/\+/g, '-').substring(0, long_url_signature ? 32 : 8);
signature = `s--${signature}--`;
}
var prefix = unsigned_url_prefix(public_id, cloud_name, private_cdn, cdn_subdomain, secure_cdn_subdomain, cname, secure, secure_distribution);
var prefix = build_distribution_domain(public_id, options);
var resultUrl = [prefix, resource_type, type, signature, transformation, version, public_id].filter(function (part) {
return part != null && part !== '';
}).join('/').replace(/ /g, '%20');
Expand Down
2 changes: 1 addition & 1 deletion lib-es5/v2/search.js
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ var Search = function () {
var dataOrderedByKey = sort_object_by_key(clear_blank(query));
var encodedQuery = base64Encode(JSON.stringify(dataOrderedByKey));

var urlPrefix = build_distribution_domain(options);
var urlPrefix = build_distribution_domain(options.source, options);

var signature = compute_hash(`${urlTtl}${encodedQuery}${apiSecret}`, 'sha256', 'hex');

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"author": "Cloudinary <[email protected]>",
"name": "cloudinary",
"description": "Cloudinary NPM for node.js integration",
"version": "1.37.3",
"version": "1.38.0",
"homepage": "http://cloudinary.com",
"license": "MIT",
"repository": {
Expand Down

0 comments on commit 262d690

Please sign in to comment.