fix: type error

This commit is contained in:
2026-02-07 00:09:52 +01:00
parent 6222f9dafe
commit 2ceb813a98

View File

@@ -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
}
return ul.data?.ufsUrl;
}