fix(webui): validate inferred file paths before preview (#4935)

This commit is contained in:
chengyongru
2026-07-15 10:45:40 +08:00
committed by GitHub
parent aa70aa48f9
commit 5ed28a6744
10 changed files with 461 additions and 51 deletions
+18
View File
@@ -200,6 +200,24 @@ export async function fetchFilePreview(
);
}
export async function fetchFilePreviewAvailability(
token: string,
key: string,
path: string,
base: string = "",
): Promise<boolean> {
const query = new URLSearchParams();
query.set("path", path);
query.set("probe", "1");
const payload = await request<{ available?: boolean }>(
`${base}/api/sessions/${encodeURIComponent(key)}/file-preview?${query}`,
token,
undefined,
API_READ_TIMEOUT_MS,
);
return payload.available !== false;
}
export async function fetchSessionAutomations(
token: string,
key: string,