Skip to content

Commit 49bf798

Browse files
author
Amir Tocker
committed
Support url suffix for shared CDN
1 parent 0a2776d commit 49bf798

File tree

4 files changed

+5
-11
lines changed

4 files changed

+5
-11
lines changed

lib/utils.js

Lines changed: 0 additions & 3 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/utils.coffee

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -471,10 +471,6 @@ exports.url = (public_id, options = {}) ->
471471
version = preloaded[3]
472472
public_id = preloaded[4]
473473

474-
if url_suffix and not private_cdn
475-
throw 'URL Suffix only supported in private CDN'
476-
477-
478474
original_source = public_id
479475
return original_source unless public_id?
480476
public_id = public_id.toString()

test/utils_spec.coffee

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -80,9 +80,10 @@ describe "utils", ->
8080
it "should use format from options" , ->
8181
test_cloudinary_url("test", {format:'jpg'}, "http://res.cloudinary.com/#{cloud_name}/image/upload/test.jpg", {})
8282

83-
it "should disallow url_suffix in shared distribution" , ->
84-
expect(()-> utils.url("test", {url_suffix:"hello"})).to.be.throwError(/URL Suffix only supported in private CDN/)
85-
83+
it "should support url_suffix in shared distribution", ->
84+
test_cloudinary_url("test", {url_suffix:"hello"}, "http://res.cloudinary.com/#{cloud_name}/images/test/hello", {})
85+
test_cloudinary_url("test", {url_suffix:"hello", angle: 0}, "http://res.cloudinary.com/#{cloud_name}/images/a_0/test/hello", {})
86+
8687
it "should disallow url_suffix in non upload types" , ->
8788
expect(()-> utils.url("test", {url_suffix:"hello", private_cdn:true, type:'facebook'})).to.be.throwError(/URL Suffix only supported for image\/upload, image\/private, image\/authenticated, video\/upload and raw\/upload/)
8889

0 commit comments

Comments
 (0)