From b70a3e9268bbabaeebe1df8e2bbb8607bbd361d8 Mon Sep 17 00:00:00 2001 From: sethburkart123 Date: Mon, 7 Oct 2024 16:56:07 +1100 Subject: [PATCH] fix(SaveTheme): images not saving properly --- src/seqta/ui/themes/shareTheme.ts | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/seqta/ui/themes/shareTheme.ts b/src/seqta/ui/themes/shareTheme.ts index 0d7b6454..445d98e2 100644 --- a/src/seqta/ui/themes/shareTheme.ts +++ b/src/seqta/ui/themes/shareTheme.ts @@ -6,7 +6,7 @@ const saveThemeFile = (data: object, fileName: string) => { const url = URL.createObjectURL(blob); const a = document.createElement('a'); a.href = url; - a.download = `${fileName}.json`; + a.download = `${fileName}.json.theme`; document.body.appendChild(a); a.click(); document.body.removeChild(a); @@ -34,13 +34,14 @@ const shareTheme = async (themeID: string) => { }); // Convert cover image to Base64 - const coverImageBlob = await fetch(coverImage as string).then(res => res.blob()); - const coverImageBase64 = await blobToBase64(coverImageBlob); + let coverImageBase64 = null; + if (coverImage) { + coverImageBase64 = await blobToBase64(coverImage); + } // Convert custom images to Base64 const finalImages = await Promise.all(CustomImages.map(async (image) => { - const imageBlob = await fetch(image.url as string).then(res => res.blob()); - const imageBase64 = await blobToBase64(imageBlob); + const imageBase64 = await blobToBase64(image.blob); return { id: image.id, variableName: image.variableName,