fix(template): resolve variable shadowing in export-html template

This commit is contained in:
QiuYuang
2026-06-29 09:51:29 +08:00
committed by GitHub
parent b1ef12055e
commit 820fadc3f2

View File

@@ -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);