Skip to content

Commit 84641f4

Browse files
committed
chore: maybe fix cloudflare-pages #2
1 parent 06514b1 commit 84641f4

File tree

1 file changed

+6
-1
lines changed
  • src/runtime/nitro/og-image/satori

1 file changed

+6
-1
lines changed

src/runtime/nitro/og-image/satori/font.ts

+6-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,12 @@ export async function loadFont({ e }: OgImageRenderEventContext, font: ResolvedF
1010
return font
1111

1212
if (font.key && await assets.hasItem(font.key)) {
13-
const fontData = await assets.getItem<string>(font.key)
13+
let fontData = await assets.getItem(font.key)
14+
// if buffer
15+
if (fontData instanceof Uint8Array) {
16+
const decoder = new TextDecoder()
17+
fontData = decoder.decode(fontData)
18+
}
1419
// fontData is a base64 string, need to turn it into a buffer
1520
// buf is a string need to convert it to a buffer
1621
font.data = Buffer.from(fontData!, 'base64')

0 commit comments

Comments
 (0)