Skip to content

Commit 7144da5

Browse files
lxsmnsycCopilotatilafassina
authored
fix: server id encoding (#2061)
Co-authored-by: Copilot <198982749+Copilot@users.noreply.github.com> Co-authored-by: atilafassina <2382552+atilafassina@users.noreply.github.com>
1 parent 71315c0 commit 7144da5

File tree

3 files changed

+7
-2
lines changed

3 files changed

+7
-2
lines changed
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@solidjs/start": patch
3+
---
4+
5+
fix: use percent encoding for `x-server-id` header value instead of reserved `#` character

packages/start/src/runtime/server-handler.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ async function handleServerFunction(h3Event: HTTPEvent) {
9090
let functionId: string | undefined | null, name: string | undefined | null;
9191
if (serverReference) {
9292
invariant(typeof serverReference === "string", "Invalid server function");
93-
[functionId, name] = serverReference.split("#");
93+
[functionId, name] = decodeURIComponent(serverReference).split("#");
9494
} else {
9595
functionId = url.searchParams.get("id");
9696
name = url.searchParams.get("name");

packages/start/src/runtime/server-runtime.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ function createRequest(base: string, id: string, instance: string, options: Requ
125125
...options,
126126
headers: {
127127
...options.headers,
128-
"X-Server-Id": id,
128+
"X-Server-Id": encodeURIComponent(id),
129129
"X-Server-Instance": instance
130130
}
131131
});

0 commit comments

Comments
 (0)