Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions next.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) => {
Expand Down
9 changes: 9 additions & 0 deletions src/app/api/submit-material/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
6 changes: 6 additions & 0 deletions src/pages/submit-material/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,9 @@ export default function SubmitMaterial({ pageCopy }: SubmitMaterialProps) {
<Label>
{pageCopy.attributes.CourseMaterials}
<input name='courseFiles' type="file" multiple accept={acceptTypes} onChange={e => setCourseFiles(e.target.files)} />
<small style={{fontSize: '1.2rem', color: '#666', marginTop: '0.5rem', display: 'block'}}>
Stöds: PDF, Word (.docx, .doc), PowerPoint (.pptx, .ppt), Text (.txt)
</small>
{errors?.courseFiles && errors?.courseFiles._errors && <ErrorMessage role="alert">{errors?.courseFiles._errors}</ErrorMessage>}
</Label>
{lectures.map((lecture, index) => {
Expand All @@ -182,6 +185,9 @@ export default function SubmitMaterial({ pageCopy }: SubmitMaterialProps) {
<Label>
{pageCopy.attributes.LectureFiles}
<input name={`lecture-${index}-files`} type="file" multiple accept={acceptTypes} />
<small style={{fontSize: '1.2rem', color: '#666', marginTop: '0.5rem', display: 'block'}}>
Stöds: PDF, Word (.docx, .doc), PowerPoint (.pptx, .ppt), Text (.txt)
</small>
{errors?.lectures && errors.lectures[index] && errors.lectures[index].files?._errors && <ErrorMessage role="alert">{errors?.lectures[index].files?._errors}</ErrorMessage>}
</Label>
</LectureWrapper>
Expand Down