Evenfire is an intelligence layer platform for running LLM agents that take real actions, on your infrastructure
TypeScript
fix(control-ui): forward raw encoded path in control-api proxy (org-scoped 404)
Andy Pavia9a03c6c94c76
diff --git a/control-ui/app/control-api/[...path]/route.ts b/control-ui/app/control-api/[...path]/route.tsindex 4216c0072..f307ad0c8 100644--- a/control-ui/app/control-api/[...path]/route.ts+++ b/control-ui/app/control-api/[...path]/route.ts@@ -108,9 +108,17 @@ const HOP_BY_HOP_HEADERS = new Set(['upgrade',])-function buildUpstreamUrl(req: NextRequest, path: string[]): string {+function buildUpstreamUrl(req: NextRequest): string {const base = CONTROL_API_INTERNAL_URL.replace(/\/$/, '')- return `${base}/${path.join('/')}${req.nextUrl.search}`+ // Forward the RAW, still-percent-encoded path — NOT the decoded [...path]+ // catch-all params. Next.js decodes catch-all segments, so `path.join('/')`+ // turns an encoded `%2F` inside an org-scoped registry name (`@org/name`) into a+ // real `/`, which splits the segment and 404s control-api's path-param routes+ // (e.g. entries/:name/versions/:version). Reading the pathname off the raw URL+ // preserves the original encoding, keeping `@org/name` a single `:name` segment+ // downstream. The `/control-api` mount prefix is stripped to match the upstream.+ const rawPath = new URL(req.url).pathname.replace(/^\/control-api(?=\/|$)/, '')+ return `${base}${rawPath}${req.nextUrl.search}`}function copyRequestHeaders(req: NextRequest): Headers {@@ -150,11 +158,11 @@ function copyResponseHeaders(source: Headers): Headers {async function proxyControlApi(req: NextRequest,- context: { params: { path: string[] } | Promise<{ path: string[] }> }+ _context: { params: { path: string[] } | Promise<{ path: string[] }> }): Promise<NextResponse> {- const params = await context.params- const path = Array.isArray(params.path) ? params.path : []- const upstreamUrl = buildUpstreamUrl(req, path)+ // Path comes from the raw request URL (encoding-preserving), not context.params+ // (which Next.js decodes — see buildUpstreamUrl).+ const upstreamUrl = buildUpstreamUrl(req)const headers = copyRequestHeaders(req)const hasBody = req.method !== 'GET' && req.method !== 'HEAD'diff --git a/control-ui/components/PublisherView/OwnedEntries.tsx b/control-ui/components/PublisherView/OwnedEntries.tsxindex 1f307ef04..0f41a58a4 100644--- a/control-ui/components/PublisherView/OwnedEntries.tsx+++ b/control-ui/components/PublisherView/OwnedEntries.tsx@@ -77,7 +77,9 @@ function groupByName(// "Connector" / "Plugin" mirror the labels in PublishToRegistryForm.function entryTypeLabel(e: OwnedRegistryEntry): string {const kind = e.entry_type ?? (e.serverMode != null ? 'mcp-server' : 'recipe')- return kind === 'mcp-server' ? 'Connector' : 'Plugin'+ if (kind === 'mcp-server') return 'Connector'+ if (kind === 'llm-hook') return 'Guardrail hook'+ return 'Plugin'}/**diff --git a/control-ui/package-lock.json b/control-ui/package-lock.jsonindex 940466ab9..c555b1a8f 100644--- a/control-ui/package-lock.json+++ b/control-ui/package-lock.json@@ -1,12 +1,12 @@{"name": "clerum-control-ui",- "version": "0.1.391",+ "version": "0.1.392","lockfileVersion": 3,"requires": true,"packages": {"": {"name": "clerum-control-ui",- "version": "0.1.391",+ "version": "0.1.392","dependencies": {"@clerum/llm-providers": "file:../packages/llm-providers","@clerum/workflow-recipe-capability-policy": "file:../packages/workflow-recipe-capability-policy",diff --git a/control-ui/package.json b/control-ui/package.jsonindex e73705849..3ac24d536 100644--- a/control-ui/package.json+++ b/control-ui/package.json@@ -1,6 +1,6 @@{"name": "clerum-control-ui",- "version": "0.1.391",+ "version": "0.1.392","private": true,"scripts": {"dev": "NEXT_IGNORE_INCORRECT_LOCKFILE=1 next dev",