File tree Expand file tree Collapse file tree 2 files changed +16
-1
lines changed
test/integration/api/uploader Expand file tree Collapse file tree 2 files changed +16
-1
lines changed Original file line number Diff line number Diff line change @@ -406,7 +406,7 @@ function build_upload_params(options) {
406406 responsive_breakpoints : utils . generate_responsive_breakpoints_string ( options . responsive_breakpoints ) ,
407407 return_delete_token : utils . as_safe_bool ( options . return_delete_token ) ,
408408 timestamp : options . timestamp || exports . timestamp ( ) ,
409- transformation : utils . generate_transformation_string ( clone ( options ) ) ,
409+ transformation : decodeURIComponent ( utils . generate_transformation_string ( clone ( options ) ) ) ,
410410 type : options . type ,
411411 unique_filename : utils . as_safe_bool ( options . unique_filename ) ,
412412 upload_preset : options . upload_preset ,
Original file line number Diff line number Diff line change @@ -91,6 +91,21 @@ describe("uploader", function () {
9191 sinon . assert . calledWith ( writeSpy , sinon . match ( helper . uploadParamMatcher ( "metadata" , METADATA_SAMPLE_DATA_ENCODED ) ) ) ;
9292 } ) ;
9393 } ) ;
94+ it ( 'should upload a file with correctly encoded transformation string' , ( ) => {
95+ return helper . provideMockObjects ( function ( mockXHR , writeSpy , requestSpy ) {
96+ const uploadResult = cloudinary . v2 . uploader . upload ( 'irrelevant' , { transformation : { overlay : { text : 'test / 火' } } } ) ;
97+ sinon . assert . calledWith ( writeSpy , sinon . match ( helper . uploadParamMatcher ( 'transformation' , 'l_text:test %2F 火' ) ) ) ;
98+ } ) ;
99+ } ) ;
100+ it ( 'should upload a file with correctly encoded transformation string incl 4bytes characters' , ( ) => {
101+ return helper . provideMockObjects ( function ( mockXHR , writeSpy , requestSpy ) {
102+ cloudinary . v2 . uploader . upload ( 'irrelevant' , { transformation : { overlay : { text : 'test 𩸽 🍺' } } } )
103+ . then ( ( uploadResult ) => {
104+ sinon . assert . calledWith ( writeSpy , sinon . match ( helper . uploadParamMatcher ( 'transformation' , 'l_text:test 𩸽 🍺' ) ) ) ;
105+ expect ( uploadResult ) . to . have . key ( "created_at" ) ;
106+ } ) ;
107+ } ) ;
108+ } ) ;
94109 it ( "should successfully upload url" , function ( ) {
95110 return cloudinary . v2 . uploader . upload ( "https://cloudinary.com/images/old_logo.png" , {
96111 tags : UPLOAD_TAGS
You can’t perform that action at this time.
0 commit comments