caldav 2026.08.27.03 — filters on calendar and contacts

This commit is contained in:
2026-08-27 14:20:52 +00:00
parent 15392ae6c2
commit 9ec60d6d75
2 changed files with 70 additions and 1 deletions
+13 -1
View File
@@ -228,7 +228,19 @@ const handleRevokedSession = (url: string) => {
const validateResponse = async (res: Response) => {
if (res.status >= 400) {
const { onError } = useClient.config;
const message = await res.text();
// Read the body ONCE, as text, and parse it ourselves — a Response body cannot be read twice.
// The platform answers `{ error: string }` since 2026-08-25, but a plugin's own routes and any
// non-Hono surface still answer plain text, so the raw text stays as the fallback.
const body = await res.text();
let message = body;
try {
const parsed: unknown = JSON.parse(body);
if (parsed && typeof parsed === 'object' && typeof (parsed as { error?: unknown }).error === 'string') {
message = (parsed as { error: string }).error;
}
} catch {
// Not JSON — keep the text as-is.
}
if (onError) {
onError({ status: res.status, message });
}