Correct to throw error if not a music file
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful

This commit is contained in:
apatil 2025-05-07 21:22:56 +01:00
parent 042a6ae021
commit fbcd7049bf

View File

@ -8,7 +8,7 @@ const MUSIC_DIR = '/app/music';
export async function POST(req: NextRequest) { export async function POST(req: NextRequest) {
const formData = await req.formData(); const formData = await req.formData();
const file = formData.get('file') as File; const file = formData.get('file') as File;
if (checkIfMusicFile(file.name)) { if (!checkIfMusicFile(file.name)) {
return NextResponse.json( return NextResponse.json(
{ error: 'Only music files are allowed to be uploaded' }, { error: 'Only music files are allowed to be uploaded' },
{ status: 400 }, { status: 400 },