Skip to content

Commit 826b4b6

Browse files
author
Amir Tocker
committed
2 parents 7baa689 + 4e328a9 commit 826b4b6

File tree

4 files changed

+25
-5
lines changed

4 files changed

+25
-5
lines changed

lib/utils.js

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

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -821,13 +821,14 @@ exports.archive_params = (options = {})->
821821
mode: options.mode
822822
notification_url: options.notification_url
823823
prefixes: options.prefixes && exports.build_array(options.prefixes)
824+
transformations: utils.build_eager(options.transformations)
824825
public_ids: options.public_ids && exports.build_array(options.public_ids)
825826
tags: options.tags && exports.build_array(options.tags)
826827
target_format: options.target_format
827828
target_public_id: options.target_public_id
828829
target_tags: options.target_tags && exports.build_array(options.target_tags)
829830
timestamp: (options.timestamp ? exports.timestamp())
830-
transformations: build_eager(options.transformations)
831+
transformations: utils.build_eager(options.transformations)
831832
type: options.type
832833
use_original_filename: exports.as_safe_bool(options.use_original_filename)
833834

@@ -840,7 +841,7 @@ exports.build_explicit_api_params = (public_id, options = {})->
840841
opt = [
841842
callback: options.callback
842843
custom_coordinates: options.custom_coordinates && utils.encode_double_array(options.custom_coordinates)
843-
eager: build_eager(options.eager)
844+
eager: utils.build_eager(options.eager)
844845
eager_async: utils.as_safe_bool(options.eager_async)
845846
eager_notification_url: options.eager_notification_url
846847
face_coordinates: options.face_coordinates && utils.encode_double_array(options.face_coordinates)

test/utils_spec.coffee

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -411,6 +411,24 @@ describe "utils", ->
411411
expect(utils.build_upload_params(options)['transformation']).to.eql("c_scale,w_100")
412412
expect(Object.keys(options).length).to.eql(2)
413413

414+
it "build_explicit_api_params should support mutiple eager transformations with a pipe" , ->
415+
options = {
416+
eager: [
417+
{width:100, crop:"scale"},
418+
{height:100, crop:"fit"},
419+
]
420+
}
421+
expect(utils.build_explicit_api_params('some_id', options)[0]['eager']).to.eql("c_scale,w_100|c_fit,h_100")
422+
423+
it "archive_params should support mutiple eager transformations with a pipe" , ->
424+
options = {
425+
transformations: [
426+
{width:200, crop:"scale"},
427+
{height:200, crop:"fit"},
428+
]
429+
}
430+
expect(utils.archive_params(options)['transformations']).to.eql("c_scale,w_200|c_fit,h_200")
431+
414432
it "build_upload_params canonize booleans" , ->
415433
options = {backup:true, use_filename:false, colors:"true", exif:"false", colors:"true", image_metadata:"false", invalidate:1, eager_async:"1"}
416434
params = utils.build_upload_params(options)

0 commit comments

Comments
 (0)