Working on API side.

This commit is contained in:
charles-gauthereau
2024-11-29 12:39:39 +01:00
parent feb10603e9
commit 7e98c4b2a1
3 changed files with 97 additions and 74 deletions
-3
View File
@@ -7,19 +7,16 @@ export async function GET(
{params}: { params: Promise<{ fileName: string }> }
) {
// Retrieve params
const {searchParams} = new URL(request.url);
const token = searchParams.get('token');
const expires = searchParams.get('expires');
const fileName = (await params).fileName
const privateLocalDir = "private/uploads/";
const filePath = path.join(privateLocalDir, fileName);
const crypto = require('crypto');
if (!fs.existsSync(filePath)) {
return NextResponse.json(
{error: 'File not found'},