Skip to content

The open-source app everyone uses to manage agents at work

fix(cli): split path and query in buildUrl to prevent %3F encoding

Matt Van Horn609b55f53009
diff --git a/cli/src/client/http.ts b/cli/src/client/http.ts
index 863249b7d6..60be8d2d53 100644
--- a/cli/src/client/http.ts
+++ b/cli/src/client/http.ts
@@ -104,8 +104,10 @@ export class PaperclipApiClient {
function buildUrl(apiBase: string, path: string): string {
const normalizedPath = path.startsWith("/") ? path : `/${path}`;
+ const [pathname, query] = normalizedPath.split("?");
const url = new URL(apiBase);
- url.pathname = `${url.pathname.replace(/\/+$/, "")}${normalizedPath}`;
+ url.pathname = `${url.pathname.replace(/\/+$/, "")}${pathname}`;
+ if (query) url.search = query;
return url.toString();
}