From a0dc4540ca57178a36b7a07209773f0559986b0d Mon Sep 17 00:00:00 2001 From: claude-code-best Date: Sun, 19 Apr 2026 08:55:55 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E6=9C=8D=E5=8A=A1?= =?UTF-8?q?=E5=99=A8=E4=B8=A4=E4=B8=AA=20/=20=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/remote-control-server/src/config.ts | 4 ++-- packages/remote-control-server/src/index.ts | 11 +++++++++++ 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/packages/remote-control-server/src/config.ts b/packages/remote-control-server/src/config.ts index f67771070..39ba2c400 100644 --- a/packages/remote-control-server/src/config.ts +++ b/packages/remote-control-server/src/config.ts @@ -18,6 +18,6 @@ export const config = { } as const; export function getBaseUrl(): string { - if (config.baseUrl) return config.baseUrl; - return `http://localhost:${config.port}`; + const url = config.baseUrl || `http://localhost:${config.port}`; + return url.replace(/\/+$/, ""); } diff --git a/packages/remote-control-server/src/index.ts b/packages/remote-control-server/src/index.ts index 44aaf3c0d..cd9991285 100644 --- a/packages/remote-control-server/src/index.ts +++ b/packages/remote-control-server/src/index.ts @@ -33,6 +33,17 @@ const app = new Hono(); // Middleware app.use("*", logger()); +app.use("*", async (c, next) => { + // Normalize double slashes in path (e.g. //v1/environments/bridge → /v1/environments/bridge) + const path = new URL(c.req.url).pathname; + if (path.includes("//")) { + const normalized = path.replace(/\/+/g, "/"); + const url = new URL(c.req.url); + url.pathname = normalized; + return app.fetch(new Request(url.toString(), c.req.raw)); + } + await next(); +}); app.use("/web/*", cors()); // Health check