From 79056f91500ccecbccbf71243830910260040137 Mon Sep 17 00:00:00 2001 From: RickardssonJ <48394514+RickardssonJ@users.noreply.github.com> Date: Tue, 9 Sep 2025 19:57:35 +0200 Subject: [PATCH 1/2] resolve ppt upload bug --- next.config.js | 12 ++++++++++++ src/app/api/submit-material/route.ts | 9 +++++++++ src/pages/submit-material/index.tsx | 6 ++++++ 3 files changed, 27 insertions(+) diff --git a/next.config.js b/next.config.js index 685b0b2..e50a599 100644 --- a/next.config.js +++ b/next.config.js @@ -7,6 +7,18 @@ const withBundleAnalyzer = require('@next/bundle-analyzer')({ const nextConfig = { reactStrictMode: true, swcMinify: true, + + // Increase body size limit for file uploads + experimental: { + serverComponentsExternalPackages: [], + }, + + // Configure API routes to handle larger file uploads + api: { + bodyParser: { + sizeLimit: '100mb', + }, + }, // https://github.com/privateOmega/html-to-docx/issues/129 webpack: (config) => { diff --git a/src/app/api/submit-material/route.ts b/src/app/api/submit-material/route.ts index 882e238..6c57c46 100644 --- a/src/app/api/submit-material/route.ts +++ b/src/app/api/submit-material/route.ts @@ -20,6 +20,15 @@ const getLectureData = (formData: FormData) => { return lectures } +// Configure body size limit for this API route +export const config = { + api: { + bodyParser: { + sizeLimit: '100mb', + }, + }, +} + // See documentation in /docs/zenodo/design.md export async function POST( req: NextRequest, diff --git a/src/pages/submit-material/index.tsx b/src/pages/submit-material/index.tsx index 077e875..355ee89 100644 --- a/src/pages/submit-material/index.tsx +++ b/src/pages/submit-material/index.tsx @@ -159,6 +159,9 @@ export default function SubmitMaterial({ pageCopy }: SubmitMaterialProps) { {lectures.map((lecture, index) => { @@ -182,6 +185,9 @@ export default function SubmitMaterial({ pageCopy }: SubmitMaterialProps) { From a79716583657a4bdd85f2899925f4ed6d19ccac5 Mon Sep 17 00:00:00 2001 From: RickardssonJ <48394514+RickardssonJ@users.noreply.github.com> Date: Tue, 9 Sep 2025 20:02:51 +0200 Subject: [PATCH 2/2] increse upload limit size --- next.config.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/next.config.js b/next.config.js index e50a599..65ae78c 100644 --- a/next.config.js +++ b/next.config.js @@ -8,7 +8,7 @@ const nextConfig = { reactStrictMode: true, swcMinify: true, - // Increase body size limit for file uploads + // Increase body size limit for file uploads. experimental: { serverComponentsExternalPackages: [], },