mirror of
https://github.com/openclaw/openclaw.git
synced 2026-06-06 12:12:54 +00:00
* fix(export-html): guard all msg.content and result.content filter/iteration paths Three call sites in the export HTML template called `.filter()` or iterated with `for...of` directly on `msg.content` or `result.content` without first checking `Array.isArray`. When a transcript message row carries a non-array content value (null, undefined, or any scalar), those paths throw: TypeError: msg.content.filter is not a function Fix: normalize with `Array.isArray(x) ? x : []` before every unguarded filter and iteration on `msg.content` (computeStats stats path and the renderEntry assistant render loops) and `result.content` (renderToolCall text/image accessors). Regression test added: renderTemplate resolves without throwing for assistant messages with null, undefined, string, and numeric content values. Closes #88255 * fix(export-html): guard user message text extraction path against non-array content The user-message render path in the export HTML template extracted text with `content.filter(...)` without checking whether `content` is an array. A persisted user message row with null, undefined, or any non-string scalar content crashed during export with the same TypeError class as the assistant path. Fix: normalize the ternary so a non-string, non-array value falls through to an empty string rather than calling `.filter` on it. Regression test added for null, undefined, and numeric user message content. Addresses feedback from ClawSweeper review on #88271. * fix(export-html): preserve string content guards --------- Co-authored-by: Peter Steinberger <steipete@gmail.com>