fix: Simplify parameter destructuring in GET functions for consistency

This commit is contained in:
2025-10-16 09:38:36 +02:00
parent 12fa9812bc
commit 9edc3ca1ec
2 changed files with 5 additions and 4 deletions

View File

@@ -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.

View File

@@ -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');