diff --git a/src/core/scan.ts b/src/core/scan.ts index e04a70704e..d5f53cf1ed 100644 --- a/src/core/scan.ts +++ b/src/core/scan.ts @@ -98,7 +98,7 @@ export async function scanServerRoutes( .replace(/\(([^(/\\]+)\)[/\\]/g, "") .replace(/\[\.{3}]/g, "**") .replace(/\[\.{3}(\w+)]/g, "**:$1") - .replace(/\[(\w+)]/g, ":$1"); + .replace(/\[([^/\]]+)]/g, ":$1"); route = withLeadingSlash(withoutTrailingSlash(withBase(route, prefix))); const suffixMatch = route.match(suffixRegex); diff --git a/test/fixture/api/param/[id].ts b/test/fixture/api/param/[test-id].ts similarity index 72% rename from test/fixture/api/param/[id].ts rename to test/fixture/api/param/[test-id].ts index 86a4d93497..4ec687eaa9 100644 --- a/test/fixture/api/param/[id].ts +++ b/test/fixture/api/param/[test-id].ts @@ -1,4 +1,4 @@ export default eventHandler((event) => { setHeader(event, "Content-Type", "text/plain; charset=utf-16"); - return event.context.params!.id; + return event.context.params!["test-id"]; });