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