Skip to content

Commit 2e8c668

Browse files
clean up
1 parent daf65d5 commit 2e8c668

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

apps/studio/electron/main/assets/images.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,11 @@ export async function saveImageToProject(
129129
const uniqueFileName = await getUniqueFileName(imageFolder, image.fileName);
130130
const imagePath = path.join(imageFolder, uniqueFileName);
131131

132-
const buffer = Buffer.from(image.content, 'base64');
132+
if (!image.content) {
133+
throw new Error('Can not save image with empty content');
134+
}
135+
136+
const buffer = Buffer.from(image.content.replace(/^data:[^,]+,/, ''), 'base64');
133137
await fs.writeFile(imagePath, buffer);
134138
return imagePath;
135139
} catch (error) {

apps/studio/src/lib/editor/engine/image/index.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,6 @@ export class ImageManager {
170170
} else {
171171
this.images = [];
172172
}
173-
console.log(this.images);
174173
}
175174

176175
dispose() {

0 commit comments

Comments
 (0)