mirror of
https://github.com/openclaw/openclaw.git
synced 2026-07-11 15:56:08 +00:00
fix(template): resolve variable shadowing in export-html template
This commit is contained in:
@@ -699,11 +699,11 @@
|
||||
return "application/octet-stream";
|
||||
}
|
||||
|
||||
function sanitizeImageBase64(data) {
|
||||
if (typeof data !== "string") {
|
||||
function sanitizeImageBase64(base64Data) {
|
||||
if (typeof base64Data !== "string") {
|
||||
return "";
|
||||
}
|
||||
const cleaned = data.replace(/\s+/g, "");
|
||||
const cleaned = base64Data.replace(/\s+/g, "");
|
||||
if (!cleaned || cleaned.length % 4 !== 0 || !SAFE_BASE64_RE.test(cleaned)) {
|
||||
return "";
|
||||
}
|
||||
@@ -712,11 +712,11 @@
|
||||
|
||||
function renderDataUrlImage(img, className) {
|
||||
const mimeType = sanitizeImageMimeType(img?.mimeType);
|
||||
const base64 = sanitizeImageBase64(img?.data);
|
||||
if (!base64) {
|
||||
const imgBase64 = sanitizeImageBase64(img?.data);
|
||||
if (!imgBase64) {
|
||||
return "";
|
||||
}
|
||||
return `<img src="data:${mimeType};base64,${base64}" class="${className}" />`;
|
||||
return `<img src="data:${mimeType};base64,${imgBase64}" class="${className}" />`;
|
||||
}
|
||||
/**
|
||||
* Truncate string to maxLen chars, append "..." if truncated.
|
||||
@@ -864,8 +864,8 @@
|
||||
div.appendChild(content);
|
||||
// Navigate to the newest leaf through this node, but scroll to the clicked node
|
||||
div.addEventListener("click", () => {
|
||||
const leafId = findNewestLeaf(entry.id);
|
||||
navigateTo(leafId, "target", entry.id);
|
||||
const targetLeafId = findNewestLeaf(entry.id);
|
||||
navigateTo(targetLeafId, "target", entry.id);
|
||||
});
|
||||
|
||||
container.appendChild(div);
|
||||
|
||||
Reference in New Issue
Block a user