Skip to content

Commit ba5d3c4

Browse files
committed
fix(app/metrics/utils): support base64 svg [skip ci]
1 parent ec50393 commit ba5d3c4

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

source/app/metrics/utils.mjs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -451,6 +451,9 @@ export async function imgb64(image, {width, height, fallback = true} = {}) {
451451
//Undefined image
452452
if (!image)
453453
return fallback ? "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mOcOnfpfwAGfgLYttYINwAAAABJRU5ErkJggg==" : null
454+
//SVG image
455+
if ((typeof image === "string") && (image.endsWith(".svg")))
456+
return `data:image/svg+xml;base64,${Buffer.from(await fetch(image).then(response => response.arrayBuffer())).toString("base64")}`
454457
//Load image
455458
let ext = "png"
456459
try {

0 commit comments

Comments
 (0)