mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-09 04:57:40 +00:00
chore: Enable "curly" rule to avoid single-statement if confusion/errors.
This commit is contained in:
@@ -12,7 +12,9 @@ export function decodeDataUrl(dataUrl: string): {
|
||||
} {
|
||||
const trimmed = dataUrl.trim();
|
||||
const match = /^data:([^;,]+);base64,([a-z0-9+/=\r\n]+)$/i.exec(trimmed);
|
||||
if (!match) throw new Error("Invalid data URL (expected base64 data: URL).");
|
||||
if (!match) {
|
||||
throw new Error("Invalid data URL (expected base64 data: URL).");
|
||||
}
|
||||
const mimeType = (match[1] ?? "").trim().toLowerCase();
|
||||
if (!mimeType.startsWith("image/")) {
|
||||
throw new Error(`Unsupported data URL type: ${mimeType || "unknown"}`);
|
||||
@@ -43,7 +45,9 @@ export function coerceImageAssistantText(params: {
|
||||
throw new Error(`Image model failed (${params.provider}/${params.model}): ${errorMessage}`);
|
||||
}
|
||||
const text = extractAssistantText(params.message);
|
||||
if (text.trim()) return text.trim();
|
||||
if (text.trim()) {
|
||||
return text.trim();
|
||||
}
|
||||
throw new Error(`Image model returned no text (${params.provider}/${params.model}).`);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user