fix: Resolve IDE type errors for local development

This commit is contained in:
cawcenter
2025-12-12 09:45:38 -05:00
parent 079804ac13
commit d5d3919704
2 changed files with 5 additions and 3 deletions

View File

@@ -139,9 +139,10 @@ export function generateFeaturedImage(input: ImageGeneratorInput): GeneratedImag
.replace(/{subtitle}/g, escapeXml(input.subtitle || template.subtitle_text || ''));
// Generate base64 data URI for inline use
const base64 = typeof Buffer !== 'undefined'
? Buffer.from(svg).toString('base64')
: btoa(unescape(encodeURIComponent(svg)));
// Use TextEncoder for Node 18+ and browser compatibility
const encoder = new TextEncoder();
const bytes = encoder.encode(svg);
const base64 = btoa(String.fromCharCode(...bytes));
const dataUri = `data:image/svg+xml;base64,${base64}`;
return {