From 9edc3ca1ecf252a38363c467d8b3824aa35f8750 Mon Sep 17 00:00:00 2001 From: b3ni15 Date: Thu, 16 Oct 2025 09:38:36 +0200 Subject: [PATCH] fix: Simplify parameter destructuring in GET functions for consistency --- src/app/api/download-part/[file_id]/[part_index]/route.ts | 5 +++-- src/app/api/file/[file_id]/route.ts | 4 ++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/app/api/download-part/[file_id]/[part_index]/route.ts b/src/app/api/download-part/[file_id]/[part_index]/route.ts index ccb332a..6dc17f2 100644 --- a/src/app/api/download-part/[file_id]/[part_index]/route.ts +++ b/src/app/api/download-part/[file_id]/[part_index]/route.ts @@ -5,9 +5,10 @@ if (!process.env.DISCORD_BOT_TOKEN || !process.env.DISCORD_CHANNEL_ID) { throw new Error('Discord bot token or channel ID is not configured'); } -export async function GET(request: Request, context: { params: { file_id: string, part_index: string } }) { +export async function GET(request: Request, { params }: any) { try { - const { file_id, part_index } = context.params; + const file_id = params.file_id as string; + const part_index = params.part_index as string; // NOTE: In a real-world scenario, you MUST validate if the user has permission to download this part. // This would involve checking the download_token against the hash in the `files` table. diff --git a/src/app/api/file/[file_id]/route.ts b/src/app/api/file/[file_id]/route.ts index 30463af..4d9aa42 100644 --- a/src/app/api/file/[file_id]/route.ts +++ b/src/app/api/file/[file_id]/route.ts @@ -2,9 +2,9 @@ import { NextResponse } from 'next/server'; import pool from '@/lib/db'; import bcrypt from 'bcrypt'; -export async function GET(request: Request, context: { params: { file_id: string } }) { +export async function GET(request: Request, { params }: any) { try { - const file_id = context.params.file_id; + const file_id = params.file_id as string; const { searchParams } = new URL(request.url); const token = searchParams.get('token');