Another attempt to fix music cover file
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
This commit is contained in:
parent
d9f84e45da
commit
369a89d7e6
@ -5,7 +5,7 @@ export async function GET(req: NextRequest, { params }: { params: Promise<{ trac
|
||||
const { track } = await params;
|
||||
try {
|
||||
const trackName = decodeURIComponent(track);
|
||||
const filePath = resolve(process.cwd(), '/music', trackName);
|
||||
const filePath = resolve(process.cwd(), 'app/music', trackName);
|
||||
const metadata = await mm.parseFile(filePath);
|
||||
const picture = metadata.common.picture?.[0];
|
||||
if (!picture) {
|
||||
@ -13,12 +13,12 @@ export async function GET(req: NextRequest, { params }: { params: Promise<{ trac
|
||||
}
|
||||
return new Response(picture.data, {
|
||||
headers: {
|
||||
'Content-Type': picture.format,
|
||||
'Content-Type': picture.format || 'image/jpeg',
|
||||
'Content-Length': picture.data.length.toString(),
|
||||
},
|
||||
});
|
||||
} catch (err) {
|
||||
console.log(err);
|
||||
console.error(err);
|
||||
return new Response('Error retrieving cover', { status: 500 });
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user