Skip to content

Commit

Permalink
Correct dataurl handling
Browse files Browse the repository at this point in the history
- fix for handling data urls with charsets, e.g., data:text/html;charset=utf-8;base64,...
  • Loading branch information
CodeSmith32 committed Jun 17, 2024
1 parent 7098f53 commit d422aac
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/renderers/html/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ import { dataURLFileLoader } from "../../utils/fileLoaders";
const HTMLRenderer: DocRenderer = ({ mainState: { currentDocument } }) => {
useEffect(() => {
const b64String = currentDocument?.fileData as string;
const bodyBase64 = b64String?.replace("data:text/html;base64,", "") || "";
const bodyBase64 =
b64String?.replace(/^data:text\/html;([^;]*?;)?base64,/, "") || "";
const body: string = window.atob(bodyBase64);

const iframeCont = document.getElementById(
Expand Down

0 comments on commit d422aac

Please sign in to comment.