Skip to content

Commit 1182e0a

Browse files
author
Amir Tocker
committed
Fix auth_token. Fix nested values in CLOUDINARY_URL.
1 parent f18ee31 commit 1182e0a

File tree

6 files changed

+8
-8
lines changed

6 files changed

+8
-8
lines changed

lib/config.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/config.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/utils.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/utils.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/config.coffee

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ _ = require("lodash")
22
cloudinary_config = undefined
33

44
isNestedKey = (key)->
5-
key.match /\w+[\[\w+\]]/
5+
key.match /\w+\[\w+\]/
66

77
###**
88
* Assign a value to a nested object

src/utils.coffee

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -424,7 +424,7 @@ exports.url = (public_id, options = {}) ->
424424
version = "v#{version}" if version?
425425

426426
transformation = transformation.replace(/([^:])\/\//g, '$1/')
427-
if sign_url && !auth_token
427+
if sign_url && _.isEmpty(auth_token)
428428
to_sign = [transformation, source_to_sign].filter((part) -> part? && part != '').join('/')
429429
shasum = crypto.createHash('sha1')
430430
shasum.update(utf8_encode(to_sign + api_secret), 'binary')
@@ -435,7 +435,7 @@ exports.url = (public_id, options = {}) ->
435435
prefix = unsigned_url_prefix(public_id, cloud_name, private_cdn, cdn_subdomain, secure_cdn_subdomain, cname, secure, secure_distribution)
436436
resultUrl = [prefix, resource_type, type, signature, transformation, version,
437437
public_id].filter((part) -> part? && part != '').join('/')
438-
if sign_url && auth_token
438+
if sign_url && !_.isEmpty(auth_token)
439439
token = utils.generate_auth_token exports.merge(url: url.parse(resultUrl).path, auth_token)
440440
resultUrl += "?#{token}"
441441
resultUrl

0 commit comments

Comments
 (0)