Skip to content

Commit 9fa12b0

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

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
@@ -670,6 +670,7 @@ Examples:
670670
-`https://api.trigger.dev/custom%3Fprefix%23segment` (percent-encoded `?` / `#`)
671671
-`\uFEFFhttps://api.trigger.dev/custom-prefix/\uFEFF` (BOM wrapper trimmed)
672672
-`\u2060https://api.trigger.dev/custom-prefix/\u2060` (word-joiner wrappers are rejected)
673+
-`\u200Bhttps://api.trigger.dev/custom-prefix/\u200B` (zero-width-space wrappers are rejected)
673674
-`https://api.trigger.dev?foo=bar`
674675
-`https://api.trigger.dev#fragment`
675676
-`https://user:pass@api.trigger.dev`

packages/ai/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,7 @@ Examples:
177177
-`https://api.trigger.dev/custom%3Fprefix%23segment` (percent-encoded `?` / `#`)
178178
-`\uFEFFhttps://api.trigger.dev/custom-prefix/\uFEFF` (BOM wrapper trimmed)
179179
-`\u2060https://api.trigger.dev/custom-prefix/\u2060` (word-joiner wrappers are rejected)
180+
-`\u200Bhttps://api.trigger.dev/custom-prefix/\u200B` (zero-width-space wrappers are rejected)
180181
-`https://api.trigger.dev?foo=bar` (query string)
181182
-`https://api.trigger.dev#fragment` (hash fragment)
182183
-`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
@@ -841,6 +841,17 @@ describe("TriggerChatTransport", function () {
841841
}).toThrowError("baseURL must not contain internal whitespace characters");
842842
});
843843

844+
it("throws when baseURL is wrapped with zero-width-space characters", function () {
845+
expect(function () {
846+
new TriggerChatTransport({
847+
task: "chat-task",
848+
accessToken: "pk_trigger",
849+
baseURL: "\u200Bhttps://api.trigger.dev/custom-prefix/\u200B",
850+
stream: "chat-stream",
851+
});
852+
}).toThrowError("baseURL must not contain internal whitespace characters");
853+
});
854+
844855
it("throws when baseURL contains internal zero-width-non-joiner characters", function () {
845856
expect(function () {
846857
new TriggerChatTransport({
@@ -3624,6 +3635,17 @@ describe("TriggerChatTransport", function () {
36243635
}).toThrowError("baseURL must not contain internal whitespace characters");
36253636
});
36263637

3638+
it("throws from factory when baseURL is wrapped with zero-width-space characters", function () {
3639+
expect(function () {
3640+
createTriggerChatTransport({
3641+
task: "chat-task",
3642+
accessToken: "pk_trigger",
3643+
baseURL: "\u200Bhttps://api.trigger.dev/custom-prefix/\u200B",
3644+
stream: "chat-stream",
3645+
});
3646+
}).toThrowError("baseURL must not contain internal whitespace characters");
3647+
});
3648+
36273649
it("throws from factory when baseURL contains internal zero-width-non-joiner characters", function () {
36283650
expect(function () {
36293651
createTriggerChatTransport({

0 commit comments

Comments
 (0)