Signed-off-by: OpenClaw Bot <ai-agent@topdoglabs.com>
This commit is contained in:
parent
54038373fc
commit
7b0ae1a56c
@ -21,7 +21,13 @@ function deriveApiBaseUrlFromGanttBoardUrl(): string | null {
|
||||
try {
|
||||
const parsed = new URL(ganttBoardUrl);
|
||||
const pathname = parsed.pathname.replace(/\/+$/, "");
|
||||
parsed.pathname = `${pathname}/api`;
|
||||
if (!pathname || pathname === "/") {
|
||||
parsed.pathname = "/api";
|
||||
} else if (pathname.endsWith("/api")) {
|
||||
parsed.pathname = pathname;
|
||||
} else {
|
||||
parsed.pathname = `${pathname}/api`;
|
||||
}
|
||||
parsed.search = "";
|
||||
parsed.hash = "";
|
||||
return normalizeBaseUrl(parsed.toString());
|
||||
@ -107,11 +113,11 @@ export async function fetchGanttApi<T>(endpoint: string): Promise<T> {
|
||||
payload?.error ||
|
||||
payload?.message ||
|
||||
(nonJsonBody ? nonJsonBody.replace(/\s+/g, " ").slice(0, 200) : response.statusText);
|
||||
throw new Error(`gantt-board API request failed (${response.status} ${endpoint}): ${details}`);
|
||||
throw new Error(`gantt-board API request failed (${response.status} ${cacheKey}): ${details}`);
|
||||
}
|
||||
|
||||
if (!isJson) {
|
||||
throw new Error(`gantt-board API request failed (${response.status} ${endpoint}): expected JSON response`);
|
||||
throw new Error(`gantt-board API request failed (${response.status} ${cacheKey}): expected JSON response`);
|
||||
}
|
||||
|
||||
return payload as T;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user