Fix all biome linter errors (#541)
This commit is contained in:
parent
f23c73f6a5
commit
e5d654bf41
46 changed files with 317 additions and 275 deletions
|
|
@ -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 {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue