@@ -334,6 +334,76 @@ describe("URL generation", function () {
334334 expect ( url ) . equal ( `https://ik.imagekit.io/test_url_endpoint/tr:di-test_path.jpg/test_path1.jpg` ) ;
335335 } ) ;
336336
337+ it ( "Signed URL with ' in filename" , function ( ) {
338+ const testURL = "https://ik.imagekit.io/test_url_endpoint/test_'_path_alt.jpg" ;
339+ const signature = getSignature ( {
340+ privateKey : "test_private_key" ,
341+ url : testURL ,
342+ urlEndpoint : "https://ik.imagekit.io/test_url_endpoint" ,
343+ expiryTimestamp : "9999999999" ,
344+ } ) ;
345+ const url = imagekit . url ( {
346+ path : "/test_'_path_alt.jpg" ,
347+ signed : true ,
348+ } ) ;
349+ expect ( url ) . equal ( `https://ik.imagekit.io/test_url_endpoint/test_'_path_alt.jpg?ik-s=${ signature } ` ) ;
350+ } ) ;
351+
352+ it ( "Signed URL with ' in filename and path" , function ( ) {
353+ const testURL = "https://ik.imagekit.io/test_url_endpoint/a'b/test_'_path_alt.jpg" ;
354+ const signature = getSignature ( {
355+ privateKey : "test_private_key" ,
356+ url : testURL ,
357+ urlEndpoint : "https://ik.imagekit.io/test_url_endpoint" ,
358+ expiryTimestamp : "9999999999" ,
359+ } ) ;
360+ const url = imagekit . url ( {
361+ path : "/a'b/test_'_path_alt.jpg" ,
362+ signed : true ,
363+ } ) ;
364+ expect ( url ) . equal ( `https://ik.imagekit.io/test_url_endpoint/a'b/test_'_path_alt.jpg?ik-s=${ signature } ` ) ;
365+ } ) ;
366+
367+ it ( "Signed URL with ' in filename, path and transformation as path" , function ( ) {
368+ const testURL = "https://ik.imagekit.io/test_url_endpoint/tr:l-text,i-Imagekit',fs-50,l-end/a'b/test_'_path_alt.jpg" ;
369+ const signature = getSignature ( {
370+ privateKey : "test_private_key" ,
371+ url : testURL ,
372+ urlEndpoint : "https://ik.imagekit.io/test_url_endpoint" ,
373+ expiryTimestamp : "9999999999" ,
374+ } ) ;
375+
376+ const url = imagekit . url ( {
377+ path : "/a'b/test_'_path_alt.jpg" ,
378+ signed : true ,
379+ transformation : [ { raw : "l-text,i-Imagekit',fs-50,l-end" } ] ,
380+ transformationPosition : "path" ,
381+ } ) ;
382+ expect ( url ) . equal (
383+ `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 } `
384+ ) ;
385+ } ) ;
386+
387+ it ( "Signed URL with ' in filename, path and transformation as query" , function ( ) {
388+ 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" ;
389+ const signature = getSignature ( {
390+ privateKey : "test_private_key" ,
391+ url : testURL ,
392+ urlEndpoint : "https://ik.imagekit.io/test_url_endpoint" ,
393+ expiryTimestamp : "9999999999" ,
394+ } ) ;
395+ const url = imagekit . url ( {
396+ path : "/a'b/test_'_path_alt.jpg" ,
397+ signed : true ,
398+ transformation : [ { raw : "l-text,i-Imagekit',fs-50,l-end" } ] ,
399+ transformationPosition : "query" ,
400+ } ) ;
401+ expect ( url ) . equal (
402+ `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 } `
403+ ) ;
404+ } ) ;
405+
406+
337407 it ( 'All combined' , function ( ) {
338408 const url = imagekit . url ( {
339409 path : "/test_path.jpg" ,
0 commit comments