From 36a3516844f7f24de2fcb79d9f84d04f3e307dce Mon Sep 17 00:00:00 2001 From: Anti Revoluzzer Date: Sun, 18 Aug 2024 09:26:36 -0700 Subject: [PATCH 1/2] encode api url components --- packages/start/src/router/routes.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/start/src/router/routes.ts b/packages/start/src/router/routes.ts index 14269357e..b82d0af66 100644 --- a/packages/start/src/router/routes.ts +++ b/packages/start/src/router/routes.ts @@ -73,7 +73,7 @@ function containsHTTP(route: Route) { const router = createRouter({ routes: (fileRoutes as unknown as Route[]).reduce((memo, route) => { if (!containsHTTP(route)) return memo; - let path = route.path.replace(/\/\([^)/]+\)/g, "").replace(/\([^)/]+\)/g, "").replace(/\*([^/]*)/g, (_, m) => `**:${m}`); + let path = route.path.replace(/\/\([^)/]+\)/g, "").replace(/\([^)/]+\)/g, "").replace(/\*([^/]*)/g, (_, m) => `**:${m}`).split('/').map(s => (s.startsWith(':') || s.startsWith('*')) ? s : encodeURIComponent(s)).join('/'); if (/:[^/]*\?/g.test(path)) { throw new Error(`Optional parameters are not supported in API routes: ${path}`); } From 88550e9e61f10feaf1b317d78d30d29aa222259b Mon Sep 17 00:00:00 2001 From: Ryan Carniato Date: Mon, 19 Aug 2024 12:07:10 -0700 Subject: [PATCH 2/2] Create thin-swans-yell.md --- .changeset/thin-swans-yell.md | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 .changeset/thin-swans-yell.md diff --git a/.changeset/thin-swans-yell.md b/.changeset/thin-swans-yell.md new file mode 100644 index 000000000..5ddc5be6e --- /dev/null +++ b/.changeset/thin-swans-yell.md @@ -0,0 +1,5 @@ +--- +"@solidjs/start": patch +--- + +encode api url components