Skip to content

Commit 01a6882

Browse files
committed
fix: svg images not rendering in server-side rendering
1 parent f700e8a commit 01a6882

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/index.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,10 @@ class CoCreateServerSideRender {
141141
) {
142142
let chunk = data.object[0].src;
143143

144+
if (typeof chunk === "string" && chunk.startsWith("data:image/svg+xml;base64,")) {
145+
chunk = Buffer.from(chunk.split(",")[1], "base64").toString("utf-8");
146+
}
147+
144148
// Replace $relativePath in the fetched chunk
145149
let path =
146150
el.getAttribute("path") || getRelativePath(file.path);

0 commit comments

Comments
 (0)