fix(ui): skip blocked local transcript image paths

This commit is contained in:
Alec Hrdina
2026-04-18 00:47:10 -05:00
committed by Peter Steinberger
parent 3cb142ff2e
commit 98316cfbbd
2 changed files with 30 additions and 1 deletions

View File

@@ -670,9 +670,13 @@ function renderMessageImages(
return html`
<div class="chat-message-images">
${images.map((img) => {
const isLocalImage = isLocalAssistantAttachmentSource(img.url);
const canProxyLocalImage =
isLocalAssistantAttachmentSource(img.url) &&
isLocalImage &&
isLocalAttachmentPreviewAllowed(img.url, opts?.localMediaPreviewRoots ?? []);
if (isLocalImage && !canProxyLocalImage) {
return nothing;
}
const imageUrl = canProxyLocalImage
? buildAssistantAttachmentUrl(img.url, opts?.basePath, opts?.authToken)
: img.url;

View File

@@ -974,6 +974,31 @@ describe("chat view", () => {
);
});
it("does not render blocked local transcript image paths", () => {
const container = document.createElement("div");
renderGroupedMessage(
container,
{
id: "user-history-image-blocked",
role: "user",
content: "",
MediaPath: "/Users/test/Documents/private.png",
MediaType: "image/png",
timestamp: Date.now(),
},
"user",
{
showToolCalls: false,
basePath: "/openclaw",
assistantAttachmentAuthToken: "session-token",
localMediaPreviewRoots: ["/tmp/openclaw"],
},
);
expect(container.querySelector(".chat-message-image")).toBeNull();
});
it("skips non-image transcript media paths after history reload", () => {
const container = document.createElement("div");