fix(cli): split path and query in buildUrl to prevent %3F encoding
The URL constructor's pathname setter encodes ? as %3F, breaking heartbeat event polling. Split query params before assignment. Fixes #204 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -104,8 +104,10 @@ export class PaperclipApiClient {
|
|||||||
|
|
||||||
function buildUrl(apiBase: string, path: string): string {
|
function buildUrl(apiBase: string, path: string): string {
|
||||||
const normalizedPath = path.startsWith("/") ? path : `/${path}`;
|
const normalizedPath = path.startsWith("/") ? path : `/${path}`;
|
||||||
|
const [pathname, query] = normalizedPath.split("?");
|
||||||
const url = new URL(apiBase);
|
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();
|
return url.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user