This commit is contained in:
parent
a76da7efde
commit
05828d5947
@ -4,9 +4,10 @@ import path from 'path';
|
||||
import { NextRequest } from 'next/server';
|
||||
const MUSIC_DIR = '/app/music';
|
||||
|
||||
export async function GET(req: NextRequest, { params }: { params: { track: string } }) {
|
||||
const track = decodeURIComponent(params.track);
|
||||
const filePath = path.join(MUSIC_DIR, track);
|
||||
export async function GET(req: NextRequest, { params }: { params: Promise<{ track: string }> }) {
|
||||
const track = (await params).track;
|
||||
const decodedTrack = decodeURIComponent(track);
|
||||
const filePath = path.join(MUSIC_DIR, decodedTrack);
|
||||
if (!fs.existsSync(filePath)) {
|
||||
return new Response('Not Found', { status: 404 });
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user