Fix all biome linter errors (#541)

This commit is contained in:
Jared Palmer 2024-11-15 12:18:17 -05:00 committed by GitHub
parent f23c73f6a5
commit e5d654bf41
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
46 changed files with 317 additions and 275 deletions

View file

@ -4,9 +4,10 @@ import { z } from 'zod';
import { auth } from '@/app/(auth)/auth';
// Use Blob instead of File since File is not available in Node.js environment
const FileSchema = z.object({
file: z
.instanceof(File)
.instanceof(Blob)
.refine((file) => file.size <= 5 * 1024 * 1024, {
message: 'File size should be less than 5MB',
})
@ -32,7 +33,7 @@ export async function POST(request: Request) {
try {
const formData = await request.formData();
const file = formData.get('file') as File;
const file = formData.get('file') as Blob;
if (!file) {
return NextResponse.json({ error: 'No file uploaded' }, { status: 400 });
@ -48,7 +49,8 @@ export async function POST(request: Request) {
return NextResponse.json({ error: errorMessage }, { status: 400 });
}
const filename = file.name;
// Get filename from formData since Blob doesn't have name property
const filename = (formData.get('file') as File).name;
const fileBuffer = await file.arrayBuffer();
try {