File tree Expand file tree Collapse file tree 2 files changed +15
-0
lines changed
Expand file tree Collapse file tree 2 files changed +15
-0
lines changed Original file line number Diff line number Diff line change @@ -82,6 +82,8 @@ function constructTransformationString(transformation: Transformation[] | undefi
8282 for ( var i = 0 , l = transformation . length ; i < l ; i ++ ) {
8383 var parsedTransformStep = [ ] ;
8484 for ( var key in transformation [ i ] ) {
85+ if ( transformation [ i ] [ key ] === undefined || transformation [ i ] [ key ] === null )
86+ continue ;
8587 var transformKey = transformationUtils . getTransformKey ( key ) ;
8688 if ( ! transformKey ) {
8789 transformKey = key ;
Original file line number Diff line number Diff line change @@ -279,6 +279,19 @@ describe("URL generation", function () {
279279 expect ( url ) . equal ( `https://ik.imagekit.io/test_url_endpoint/tr:di-test_path.jpg/test_path1.jpg` ) ;
280280 } ) ;
281281
282+ it ( 'skip transformation if it is undefined or null' , function ( ) {
283+ const url = imagekit . url ( {
284+ path : "/test_path1.jpg" ,
285+ transformation : [ {
286+ defaultImage : "/test_path.jpg" ,
287+ quality : undefined ,
288+ effectContrast : null
289+ } ]
290+ } )
291+
292+ expect ( url ) . equal ( `https://ik.imagekit.io/test_url_endpoint/tr:di-test_path.jpg/test_path1.jpg` ) ;
293+ } ) ;
294+
282295 it ( 'All combined' , function ( ) {
283296 const url = imagekit . url ( {
284297 path : "/test_path.jpg" ,
You can’t perform that action at this time.
0 commit comments