Skip to content

Commit

Permalink
chore: maybe fix cloudflare-pages #2
Browse files Browse the repository at this point in the history
  • Loading branch information
harlan-zw committed Mar 4, 2024
1 parent 06514b1 commit 84641f4
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/runtime/nitro/og-image/satori/font.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,12 @@ export async function loadFont({ e }: OgImageRenderEventContext, font: ResolvedF
return font

if (font.key && await assets.hasItem(font.key)) {
const fontData = await assets.getItem<string>(font.key)
let fontData = await assets.getItem(font.key)
// if buffer
if (fontData instanceof Uint8Array) {
const decoder = new TextDecoder()
fontData = decoder.decode(fontData)
}
// fontData is a base64 string, need to turn it into a buffer
// buf is a string need to convert it to a buffer
font.data = Buffer.from(fontData!, 'base64')
Expand Down

0 comments on commit 84641f4

Please sign in to comment.