mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-06 08:20:43 +00:00
fix(ui): skip blocked local transcript image paths
This commit is contained in:
committed by
Peter Steinberger
parent
3cb142ff2e
commit
98316cfbbd
@@ -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;
|
||||
|
||||
@@ -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");
|
||||
|
||||
|
||||
Reference in New Issue
Block a user