Skip to content

Commit 140fc20

Browse files
Cover zero-width-non-joiner wrapper baseURL rejection
Co-authored-by: Eric Allam <eric@trigger.dev>
1 parent 9fa12b0 commit 140fc20

File tree

3 files changed

+24
-0
lines changed

3 files changed

+24
-0
lines changed

docs/tasks/streams.mdx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -671,6 +671,7 @@ Examples:
671671
-`\uFEFFhttps://api.trigger.dev/custom-prefix/\uFEFF` (BOM wrapper trimmed)
672672
-`\u2060https://api.trigger.dev/custom-prefix/\u2060` (word-joiner wrappers are rejected)
673673
-`\u200Bhttps://api.trigger.dev/custom-prefix/\u200B` (zero-width-space wrappers are rejected)
674+
-`\u200Chttps://api.trigger.dev/custom-prefix/\u200C` (zero-width-non-joiner wrappers are rejected)
674675
-`https://api.trigger.dev?foo=bar`
675676
-`https://api.trigger.dev#fragment`
676677
-`https://user:pass@api.trigger.dev`

packages/ai/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -178,6 +178,7 @@ Examples:
178178
-`\uFEFFhttps://api.trigger.dev/custom-prefix/\uFEFF` (BOM wrapper trimmed)
179179
-`\u2060https://api.trigger.dev/custom-prefix/\u2060` (word-joiner wrappers are rejected)
180180
-`\u200Bhttps://api.trigger.dev/custom-prefix/\u200B` (zero-width-space wrappers are rejected)
181+
-`\u200Chttps://api.trigger.dev/custom-prefix/\u200C` (zero-width-non-joiner wrappers are rejected)
181182
-`https://api.trigger.dev?foo=bar` (query string)
182183
-`https://api.trigger.dev#fragment` (hash fragment)
183184
-`https://user:pass@api.trigger.dev` (credentials)

packages/ai/src/chatTransport.test.ts

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -852,6 +852,17 @@ describe("TriggerChatTransport", function () {
852852
}).toThrowError("baseURL must not contain internal whitespace characters");
853853
});
854854

855+
it("throws when baseURL is wrapped with zero-width-non-joiner characters", function () {
856+
expect(function () {
857+
new TriggerChatTransport({
858+
task: "chat-task",
859+
accessToken: "pk_trigger",
860+
baseURL: "\u200Chttps://api.trigger.dev/custom-prefix/\u200C",
861+
stream: "chat-stream",
862+
});
863+
}).toThrowError("baseURL must not contain internal whitespace characters");
864+
});
865+
855866
it("throws when baseURL contains internal zero-width-non-joiner characters", function () {
856867
expect(function () {
857868
new TriggerChatTransport({
@@ -3646,6 +3657,17 @@ describe("TriggerChatTransport", function () {
36463657
}).toThrowError("baseURL must not contain internal whitespace characters");
36473658
});
36483659

3660+
it("throws from factory when baseURL is wrapped with zero-width-non-joiner characters", function () {
3661+
expect(function () {
3662+
createTriggerChatTransport({
3663+
task: "chat-task",
3664+
accessToken: "pk_trigger",
3665+
baseURL: "\u200Chttps://api.trigger.dev/custom-prefix/\u200C",
3666+
stream: "chat-stream",
3667+
});
3668+
}).toThrowError("baseURL must not contain internal whitespace characters");
3669+
});
3670+
36493671
it("throws from factory when baseURL contains internal zero-width-non-joiner characters", function () {
36503672
expect(function () {
36513673
createTriggerChatTransport({

0 commit comments

Comments
 (0)