You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* Specifies how the overlay input text should be encoded. The default is `auto`, which means the SDK will initially treat the text as plain text to improve URL readability. If the text contains special characters, the SDK will automatically switch to `base64` encoding.
528
+
*
529
+
* You can also explicitly set the encoding to either `plain` or `base64`.
530
+
*
531
+
* The `plain` option uses the format `i-{input}`, while `base64` uses `ie-{base64_encoded_input}`.
532
+
*
533
+
* * Regardless of the encoding method, the input text is always percent-encoded to ensure it is URL-safe.
* Specifies how the overlay input path should be encoded. The default is `auto`, which means the SDK will initially treat the path as plain text to improve URL readability. If the path contains special characters, the SDK will automatically switch to `base64` encoding.
553
+
*
554
+
* You can also explicitly set the encoding to either `plain` or `base64`.
555
+
*
556
+
* The `plain` option uses the format `i-{input}`, while `base64` uses `ie-{base64_encoded_input}`.
557
+
*
558
+
* * Regardless of the encoding method:
559
+
* - Leading and trailing slashes are removed.
560
+
* - Any remaining slashes within the path are replaced with `@@` when using plain text.
561
+
*/
562
+
encoding: "auto"|"plain"|"base64";
563
+
540
564
/**
541
565
* Array of transformations to be applied to the overlay image. Supported transformations depends on the base/parent asset.
* Specifies how the overlay input path should be encoded. The default is `auto`, which means the SDK will initially treat the path as plain text to improve URL readability. If the path contains special characters, the SDK will automatically switch to `base64` encoding.
581
+
*
582
+
* You can also explicitly set the encoding to either `plain` or `base64`.
583
+
*
584
+
* The `plain` option uses the format `i-{input}`, while `base64` uses `ie-{base64_encoded_input}`.
585
+
*
586
+
* * Regardless of the encoding method:
587
+
* - Leading and trailing slashes are removed.
588
+
* - Any remaining slashes within the path are replaced with `@@` when using plain text.
589
+
*/
590
+
encoding: "auto"|"plain"|"base64";
591
+
555
592
/**
556
593
* Array of transformation to be applied to the overlay video. Except `streamingResolutions`, all other video transformations are supported.
* Specifies how the overlay input path should be encoded. The default is `auto`, which means the SDK will initially treat the path as plain text to improve URL readability. If the path contains special characters, the SDK will automatically switch to `base64` encoding.
609
+
*
610
+
* You can also explicitly set the encoding to either `plain` or `base64`.
611
+
*
612
+
* The `plain` option uses the format `i-{input}`, while `base64` uses `ie-{base64_encoded_input}`.
613
+
*
614
+
* * Regardless of the encoding method:
615
+
* - Leading and trailing slashes are removed.
616
+
* - Any remaining slashes within the path are replaced with `@@` when using plain text.
constSIMPLE_OVERLAY_TEXT_REGEX=newRegExp('^[a-zA-Z0-9-._, ]*$')// These characters are selected by testing actual URLs on both path and query parameters. If and when backend starts supporting wide range of characters, this regex should be updated to improve URL readability.
it('Image overlay generates correct URL with input logo.png',function(){
@@ -268,6 +268,79 @@ describe("Overlay Transformation Test Cases", function () {
268
268
]
269
269
});
270
270
271
-
expect(url).equal(`https://ik.imagekit.io/test_url_endpoint/tr:l-text,ie-${encodeURIComponent(safeBtoa("Every thing"))},lxo-10,lyo-20,lfo-center,lso-5,leo-15,ldu-10,w-bw_mul_0.5,fs-20,ff-Arial,co-0000ff,ia-left,pa-5,al-7,tg-b,bg-red,r-10,rt-N45,fl-h,lh-20,l-end:l-image,i-logo.png,lxo-10,lyo-20,lfo-center,lso-5,leo-15,ldu-10,w-bw_mul_0.5,h-bh_mul_0.5,rt-N45,fl-h,l-text,ie-${encodeURIComponent(safeBtoa("Nested text overlay"))},l-end,l-end:l-video,i-play-pause-loop.mp4,lxo-10,lyo-20,lfo-center,lso-5,leo-15,ldu-10,l-end:l-subtitle,i-subtitle.srt,lxo-10,lyo-20,lfo-center,lso-5,leo-15,ldu-10,l-end:l-image,i-ik_canvas,bg-FF0000,lxo-10,lyo-20,lfo-center,lso-5,leo-15,ldu-10,w-bw_mul_0.5,h-bh_mul_0.5,rt-N45,fl-h,l-end/base-image.jpg`)
271
+
expect(url).equal(`https://ik.imagekit.io/test_url_endpoint/tr:l-text,i-${encodeURIComponent("Every thing")},lxo-10,lyo-20,lfo-center,lso-5,leo-15,ldu-10,w-bw_mul_0.5,fs-20,ff-Arial,co-0000ff,ia-left,pa-5,al-7,tg-b,bg-red,r-10,rt-N45,fl-h,lh-20,l-end:l-image,i-logo.png,lxo-10,lyo-20,lfo-center,lso-5,leo-15,ldu-10,w-bw_mul_0.5,h-bh_mul_0.5,rt-N45,fl-h,l-text,i-${encodeURIComponent("Nested text overlay")},l-end,l-end:l-video,i-play-pause-loop.mp4,lxo-10,lyo-20,lfo-center,lso-5,leo-15,ldu-10,l-end:l-subtitle,i-subtitle.srt,lxo-10,lyo-20,lfo-center,lso-5,leo-15,ldu-10,l-end:l-image,i-ik_canvas,bg-FF0000,lxo-10,lyo-20,lfo-center,lso-5,leo-15,ldu-10,w-bw_mul_0.5,h-bh_mul_0.5,rt-N45,fl-h,l-end/base-image.jpg`)
272
272
});
273
273
});
274
+
275
+
276
+
describe("Edge cases",function(){
277
+
constimagekit=newImageKit({
278
+
...initializationParams,
279
+
urlEndpoint: "https://ik.imagekit.io/demo",// Using real url to test correctness quickly by clicking link
280
+
});
281
+
282
+
it('Nested simple path, should use i instead of ie, handle slash properly',function(){
0 commit comments