惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

Y
Y Combinator Blog
宝玉的分享
宝玉的分享
月光博客
月光博客
小众软件
小众软件
Jina AI
Jina AI
WordPress大学
WordPress大学
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
T
Tailwind CSS Blog
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
博客园 - 【当耐特】
博客园 - 三生石上(FineUI控件)
博客园 - 司徒正美
大猫的无限游戏
大猫的无限游戏
The Cloudflare Blog
G
Google Developers Blog
M
MIT News - Artificial intelligence
N
Netflix TechBlog - Medium
云风的 BLOG
云风的 BLOG
MyScale Blog
MyScale Blog
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
爱范儿
爱范儿
U
Unit 42
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
Blog — PlanetScale
Blog — PlanetScale

Recent Commits to openclaw:main

test: merge chat side-result checks · openclaw/openclaw@ddd2c2a test: merge cron history checks · openclaw/openclaw@f7eb746 test: merge responsive navigation shell checks · openclaw/openclaw@c2e4b47 docs(changelog): add codex oauth fixes · openclaw/openclaw@628e6cd test: merge navigation routing cases · openclaw/openclaw@5d8cecb Tests: mock channel registry bundled fallback · openclaw/openclaw@2b08233 Secrets: avoid broad web search discovery for single plugin config · openclaw/openclaw@a464f59 test: merge config view browser checks · openclaw/openclaw@20cf511 fix(status): align oauth health with runtime · openclaw/openclaw@eed7116 feat: add macOS screen snapshots for monitor preview (#67954) thanks … · openclaw/openclaw@f377db1 fix: report shared auth scopes in hello-ok (#67810) thanks @BunsDev · openclaw/openclaw@0b6c39b Auto-reply: avoid eager bundled route fallback · openclaw/openclaw@3ea1bf4 Tests: narrow session binding contract setup · openclaw/openclaw@54e4e16 fix(macOS): enable undo/redo in webchat composer text input (#34962) · openclaw/openclaw@00951dc Tests: speed up channel setup promotion · openclaw/openclaw@82b529a Docs: refresh agent instructions · openclaw/openclaw@5775fe2 fix(auth): serialize OAuth refresh across agents to fix #26322 (#67876) · openclaw/openclaw@8e79080 test: allow ollama public surface boundary test · openclaw/openclaw@7d4f1a6 Docs: add test performance guardrails · openclaw/openclaw@89706d3 Tests: restore context-engine usage proof · openclaw/openclaw@e4c4f95 Tests: slim context engine runtime coverage · openclaw/openclaw@74c198f ci: retry failed custom checkouts · openclaw/openclaw@0ee5baf test: trim duplicate provider auth onboarding cases · openclaw/openclaw@1ffc02e matrix: fix sessions_spawn --thread subagent session spawning (#67643) · openclaw/openclaw@1ce2596 test: reduce auth choice fixture churn · openclaw/openclaw@857b9cd test: mock health status config boundaries · openclaw/openclaw@9d5ab4a test: mock onboard config io boundary · openclaw/openclaw@299694d test: mock legacy state plugin boundaries · openclaw/openclaw@2713089 test: mock channel install boundaries · openclaw/openclaw@b945248 test: mock doctor preview channel boundaries · openclaw/openclaw@b1a3ad4
fix(nextcloud-talk): wrap malformed api json · openclaw/o...
vincentkoc · 2026-05-15 · via Recent Commits to openclaw:main

File tree

  • extensions/nextcloud-talk/src

Original file line numberDiff line numberDiff line change

@@ -84,6 +84,7 @@ Docs: https://docs.openclaw.ai

8484

- DeepInfra video: report malformed successful API JSON responses with provider-owned errors instead of leaking raw parser failures.

8585

- Brave Search: report malformed web and LLM-context API JSON with provider-owned errors instead of leaking raw parser failures.

8686

- xAI tools: report malformed web search, X search, and code execution JSON with provider-owned errors instead of leaking raw parser failures.

87+

- Nextcloud Talk: report malformed room-info and bot-admin JSON with channel-owned errors instead of leaking raw parser failures.

8788

- Twilio voice-call: report malformed successful API JSON responses with provider-owned errors instead of leaking raw parser failures.

8889

- Voice-call provider APIs: report malformed successful guarded JSON responses with provider-prefixed errors instead of leaking raw parser failures.

8990

- Realtime transcription: report malformed provider websocket JSON frames with owned parser errors instead of leaking raw `SyntaxError` objects.

Original file line numberDiff line numberDiff line change

@@ -94,6 +94,24 @@ describe("probeNextcloudTalkBotResponseFeature", () => {

9494

});

9595

});

9696
97+

it("reports malformed bot admin JSON with a stable channel error", async () => {

98+

hoisted.fetchWithSsrFGuard.mockResolvedValueOnce({

99+

response: new Response("{ nope", {

100+

status: 200,

101+

headers: { "content-type": "application/json" },

102+

}),

103+

release: async () => {},

104+

finalUrl: "https://cloud.example.com/ocs/v2.php/apps/spreed/api/v1/bot/admin",

105+

});

106+
107+

await expect(probeNextcloudTalkBotResponseFeature({ account: account() })).resolves.toEqual({

108+

ok: false,

109+

code: "request_failed",

110+

message:

111+

"Nextcloud Talk bot response feature probe failed: Nextcloud Talk bot response feature probe failed: malformed JSON response",

112+

});

113+

});

114+
97115

it("skips when API credentials are absent", async () => {

98116

await expect(

99117

probeNextcloudTalkBotResponseFeature({

Original file line numberDiff line numberDiff line change

@@ -1,4 +1,5 @@

11

import { formatErrorMessage } from "openclaw/plugin-sdk/error-runtime";

2+

import { readProviderJsonResponse } from "openclaw/plugin-sdk/provider-http";

23

import { fetchWithSsrFGuard } from "../runtime-api.js";

34

import type { ResolvedNextcloudTalkAccount } from "./accounts.js";

45

import { resolveNextcloudTalkApiCredentials } from "./api-credentials.js";

@@ -135,9 +136,9 @@ export async function probeNextcloudTalkBotResponseFeature(params: {

135136

};

136137

}

137138
138-

const payload = (await response.json()) as {

139+

const payload = await readProviderJsonResponse<{

139140

ocs?: { data?: NextcloudTalkBotAdminEntry[] };

140-

};

141+

}>(response, "Nextcloud Talk bot response feature probe failed");

141142

const bots = Array.isArray(payload.ocs?.data) ? payload.ocs.data : [];

142143

const bot = bots.find((entry) => normalizeUrlForMatch(entry.url) === webhookUrl);

143144

if (!bot) {

@@ -172,10 +173,11 @@ export async function probeNextcloudTalkBotResponseFeature(params: {

172173

await release();

173174

}

174175

} catch (error) {

176+

const detail = error instanceof Error ? error.message : formatErrorMessage(error);

175177

return {

176178

ok: false,

177179

code: "request_failed",

178-

message: `Nextcloud Talk bot response feature probe failed: ${formatErrorMessage(error)}`,

180+

message: `Nextcloud Talk bot response feature probe failed: ${detail}`,

179181

};

180182

}

181183

}

Original file line numberDiff line numberDiff line change

@@ -110,6 +110,39 @@ describe("nextcloud talk room info", () => {

110110

expect(release).toHaveBeenCalledTimes(1);

111111

});

112112
113+

it("reports malformed room info JSON with a stable channel error", async () => {

114+

const release = vi.fn(async () => {});

115+

const log = vi.fn();

116+

const error = vi.fn();

117+

const exit = vi.fn();

118+

fetchWithSsrFGuard.mockResolvedValue({

119+

response: new Response("{ nope", {

120+

status: 200,

121+

headers: { "content-type": "application/json" },

122+

}),

123+

release,

124+

});

125+
126+

const kind = await resolveNextcloudTalkRoomKind({

127+

account: {

128+

accountId: "acct-malformed",

129+

baseUrl: "https://nc.example.com",

130+

config: {

131+

apiUser: "bot",

132+

apiPassword: "secret",

133+

},

134+

} as never,

135+

roomToken: "room-malformed",

136+

runtime: { log, error, exit },

137+

});

138+
139+

expect(kind).toBeUndefined();

140+

expect(error).toHaveBeenCalledWith(

141+

"nextcloud-talk: room lookup error: Error: Nextcloud Talk room info failed: malformed JSON response",

142+

);

143+

expect(release).toHaveBeenCalledTimes(1);

144+

});

145+
113146

it("returns undefined from room info without credentials or base url", async () => {

114147

await expect(

115148

resolveNextcloudTalkRoomKind({

Original file line numberDiff line numberDiff line change

@@ -1,4 +1,5 @@

11

import { formatErrorMessage } from "openclaw/plugin-sdk/error-runtime";

2+

import { readProviderJsonResponse } from "openclaw/plugin-sdk/provider-http";

23

import { ssrfPolicyFromPrivateNetworkOptIn } from "openclaw/plugin-sdk/ssrf-runtime";

34

import { fetchWithSsrFGuard, type RuntimeEnv } from "../runtime-api.js";

45

import type { ResolvedNextcloudTalkAccount } from "./accounts.js";

@@ -107,9 +108,9 @@ export async function resolveNextcloudTalkRoomKind(params: {

107108

return undefined;

108109

}

109110
110-

const payload = (await response.json()) as {

111+

const payload = await readProviderJsonResponse<{

111112

ocs?: { data?: { type?: number | string } };

112-

};

113+

}>(response, "Nextcloud Talk room info failed");

113114

const type = coerceRoomType(payload.ocs?.data?.type);

114115

const kind = resolveRoomKindFromType(type);

115116

roomCache.set(key, { fetchedAt: Date.now(), kind });