@@ -74,7 +74,7 @@ describe("URL generation", function () {
7474 path : "/test_é_path_alt.jpg" ,
7575 signed : true ,
7676 } ) ;
77- expect ( url ) . equal ( `https://ik.imagekit.io/test_url_endpoint/test_é_path_alt .jpg?ik-s=${ signature } ` ) ;
77+ expect ( url ) . equal ( `https://ik.imagekit.io/test_url_endpoint/test_%C3%A9_path_alt .jpg?ik-s=${ signature } ` ) ;
7878 } ) ;
7979
8080 it ( "Signed URL with é in filename and path" , function ( ) {
@@ -91,7 +91,7 @@ describe("URL generation", function () {
9191 path : "/aéb/test_é_path_alt.jpg" ,
9292 signed : true ,
9393 } ) ;
94- expect ( url ) . equal ( `https://ik.imagekit.io/test_url_endpoint/aéb/test_é_path_alt .jpg?ik-s=${ signature } ` ) ;
94+ expect ( url ) . equal ( `https://ik.imagekit.io/test_url_endpoint/a%C3%A9b/test_%C3%A9_path_alt .jpg?ik-s=${ signature } ` ) ;
9595 } ) ;
9696
9797 it ( "Signed URL with é in filename, path and transformation as path" , function ( ) {
@@ -112,7 +112,7 @@ describe("URL generation", function () {
112112 transformationPosition : "path" ,
113113 } ) ;
114114 expect ( url ) . equal (
115- `https://ik.imagekit.io/test_url_endpoint/tr:l-text,i-Imagekité ,fs-50,l-end/aéb/test_é_path_alt .jpg?ik-s=${ signature } `
115+ `https://ik.imagekit.io/test_url_endpoint/tr:l-text,i-Imagekit%C3%A9 ,fs-50,l-end/a%C3%A9b/test_%C3%A9_path_alt .jpg?ik-s=${ signature } `
116116 ) ;
117117 } ) ;
118118
@@ -133,7 +133,7 @@ describe("URL generation", function () {
133133 transformationPosition : "query" ,
134134 } ) ;
135135 expect ( url ) . equal (
136- `https://ik.imagekit.io/test_url_endpoint/aéb/test_é_path_alt .jpg?tr=l-text%2Ci-Imagekit%C3%A9%2Cfs-50%2Cl-end&ik-s=${ signature } `
136+ `https://ik.imagekit.io/test_url_endpoint/a%C3%A9b/test_%C3%A9_path_alt .jpg?tr=l-text%2Ci-Imagekit%C3%A9%2Cfs-50%2Cl-end&ik-s=${ signature } `
137137 ) ;
138138 } ) ;
139139
@@ -333,6 +333,76 @@ describe("URL generation", function () {
333333 expect ( url ) . equal ( `https://ik.imagekit.io/test_url_endpoint/tr:di-test_path.jpg/test_path1.jpg` ) ;
334334 } ) ;
335335
336+ it ( "Signed URL with ' in filename" , function ( ) {
337+ const testURL = "https://ik.imagekit.io/test_url_endpoint/test_'_path_alt.jpg" ;
338+ const signature = getSignature ( {
339+ privateKey : "test_private_key" ,
340+ url : testURL ,
341+ urlEndpoint : "https://ik.imagekit.io/test_url_endpoint" ,
342+ expiryTimestamp : "9999999999" ,
343+ } ) ;
344+ const url = imagekit . url ( {
345+ path : "/test_'_path_alt.jpg" ,
346+ signed : true ,
347+ } ) ;
348+ expect ( url ) . equal ( `https://ik.imagekit.io/test_url_endpoint/test_'_path_alt.jpg?ik-s=${ signature } ` ) ;
349+ } ) ;
350+
351+ it ( "Signed URL with ' in filename and path" , function ( ) {
352+ const testURL = "https://ik.imagekit.io/test_url_endpoint/a'b/test_'_path_alt.jpg" ;
353+ const signature = getSignature ( {
354+ privateKey : "test_private_key" ,
355+ url : testURL ,
356+ urlEndpoint : "https://ik.imagekit.io/test_url_endpoint" ,
357+ expiryTimestamp : "9999999999" ,
358+ } ) ;
359+ const url = imagekit . url ( {
360+ path : "/a'b/test_'_path_alt.jpg" ,
361+ signed : true ,
362+ } ) ;
363+ expect ( url ) . equal ( `https://ik.imagekit.io/test_url_endpoint/a'b/test_'_path_alt.jpg?ik-s=${ signature } ` ) ;
364+ } ) ;
365+
366+ it ( "Signed URL with ' in filename, path and transformation as path" , function ( ) {
367+ const testURL = "https://ik.imagekit.io/test_url_endpoint/tr:l-text,i-Imagekit',fs-50,l-end/a'b/test_'_path_alt.jpg" ;
368+ const signature = getSignature ( {
369+ privateKey : "test_private_key" ,
370+ url : testURL ,
371+ urlEndpoint : "https://ik.imagekit.io/test_url_endpoint" ,
372+ expiryTimestamp : "9999999999" ,
373+ } ) ;
374+
375+ const url = imagekit . url ( {
376+ path : "/a'b/test_'_path_alt.jpg" ,
377+ signed : true ,
378+ transformation : [ { raw : "l-text,i-Imagekit',fs-50,l-end" } ] ,
379+ transformationPosition : "path" ,
380+ } ) ;
381+ expect ( url ) . equal (
382+ `https://ik.imagekit.io/test_url_endpoint/tr:l-text,i-Imagekit',fs-50,l-end/a'b/test_'_path_alt.jpg?ik-s=${ signature } `
383+ ) ;
384+ } ) ;
385+
386+ it ( "Signed URL with ' in filename, path and transformation as query" , function ( ) {
387+ const testURL = "https://ik.imagekit.io/test_url_endpoint/a'b/test_'_path_alt.jpg?tr=l-text%2Ci-Imagekit%27%2Cfs-50%2Cl-end" ;
388+ const signature = getSignature ( {
389+ privateKey : "test_private_key" ,
390+ url : testURL ,
391+ urlEndpoint : "https://ik.imagekit.io/test_url_endpoint" ,
392+ expiryTimestamp : "9999999999" ,
393+ } ) ;
394+ const url = imagekit . url ( {
395+ path : "/a'b/test_'_path_alt.jpg" ,
396+ signed : true ,
397+ transformation : [ { raw : "l-text,i-Imagekit',fs-50,l-end" } ] ,
398+ transformationPosition : "query" ,
399+ } ) ;
400+ expect ( url ) . equal (
401+ `https://ik.imagekit.io/test_url_endpoint/a'b/test_'_path_alt.jpg?tr=l-text%2Ci-Imagekit%27%2Cfs-50%2Cl-end&ik-s=${ signature } `
402+ ) ;
403+ } ) ;
404+
405+
336406 it ( 'All combined' , function ( ) {
337407 const url = imagekit . url ( {
338408 path : "/test_path.jpg" ,
0 commit comments