From 12fa9812bc78bda79b2dd08bc27963ffe7e709fe Mon Sep 17 00:00:00 2001 From: b3ni15 Date: Thu, 16 Oct 2025 09:36:43 +0200 Subject: [PATCH] fix: Update parameter destructuring in GET functions for consistency --- src/app/api/download-part/[file_id]/[part_index]/route.ts | 4 ++-- src/app/api/file/[file_id]/route.ts | 4 ++-- 2 files changed, 4 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 b16d91a..ccb332a 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,9 @@ 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, { params }: { params: { file_id: string, part_index: string } }) { +export async function GET(request: Request, context: { params: { file_id: string, part_index: string } }) { try { - const { file_id, part_index } = params; + const { file_id, part_index } = context.params; // 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 4d9aa42..30463af 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, { params }: any) { +export async function GET(request: Request, context: { params: { file_id: string } }) { try { - const file_id = params.file_id as string; + const file_id = context.params.file_id; const { searchParams } = new URL(request.url); const token = searchParams.get('token');