diff --git a/apps/web/src/lib/utils/genIdenticonUpload.ts b/apps/web/src/lib/utils/genIdenticonUpload.ts index 95469ed..37de49a 100644 --- a/apps/web/src/lib/utils/genIdenticonUpload.ts +++ b/apps/web/src/lib/utils/genIdenticonUpload.ts @@ -1,5 +1,5 @@ -import { utapi } from "../services/uploadthing/server"; -import sharp from "sharp"; +import sharp from 'sharp'; +import { utapi } from '../services/uploadthing/server'; export async function genIdenticonUpload(str: string, type?: string) { const identicon = await fetch(`https://api.dicebear.com/9.x/identicon/svg?seed=${str}&size=256`); @@ -7,13 +7,13 @@ export async function genIdenticonUpload(str: string, type?: string) { .webp({ quality: 80 }) .toBuffer(); - const file = new File([webpBuffer], `${str}${type ? `-${type}` : ""}.webp`, { - type: "image/webp", + const file = new File([new Uint8Array(webpBuffer)], `${str}${type ? `-${type}` : ''}.webp`, { + type: 'image/webp', }); const ul = await utapi.uploadFiles(file); if (ul.error) { - throw new Error("Failed to upload identicon: " + ul.error); + throw new Error('Failed to upload identicon: ' + ul.error); } - return ul.data?.ufsUrl -} \ No newline at end of file + return ul.data?.ufsUrl; +}