Skip to content

docs: document multipart file upload decorator - #239

Merged
yuchem2 merged 2 commits into
developfrom
CARGO-439
Jul 16, 2026
Merged

yuchem2 merged 2 commits into
developfrom
CARGO-439

Conversation

@yuchem2

@yuchem2 yuchem2 commented Jul 9, 2026

Copy link
Copy Markdown
Member

multipart/form-data에 대한 지원이 추가되면서 해당 데코레이터를 사용하는 가이드 문서를 추가합니다.

@yuchem2 yuchem2 self-assigned this Jul 9, 2026

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

이번 풀 리퀘스트는 'multipart/form-data' 요청에서 파일을 바인딩하기 위한 새로운 데코레이터인 '@uploadedfile()' 및 '@uploadedfiles()'에 대한 다국어 가이드 문서와 사이드바 설정을 추가합니다. 리뷰어는 Express 4 이하 버전에서 비동기 미들웨어 예제 코드('parseMultipart') 실행 시 발생할 수 있는 에러 핸들링 누락 문제를 방지하기 위해 'try/catch' 블록을 추가할 것을 권장하였으며, 'README.md' 파일 내 일관성을 위해 소문자로 표기된 '@params()'를 대문자 '@params()'로 수정하도록 제안했습니다.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

Comment on lines +129 to +133
async function parseMultipart(req: Request, _res: Response, next: NextFunction) {
const [, files] = await formidable().parse(req)
;(req as any).files = files // Record<string, File[]>
next()
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

Express 4 이하 버전에서는 비동기(async) 미들웨어 내부에서 에러가 발생했을 때 try/catch 블록으로 감싸서 next(err)를 호출하지 않으면, 에러가 Express 에러 핸들러로 전달되지 않고 요청이 무한 대기(hang) 상태에 빠지거나 프로세스가 종료될 수 있습니다.

가이드 문서의 예제 코드에서도 안전하게 에러를 처리할 수 있도록 try/catch 블록을 추가하는 것을 권장합니다.

Suggested change
async function parseMultipart(req: Request, _res: Response, next: NextFunction) {
const [, files] = await formidable().parse(req)
;(req as any).files = files // Record<string, File[]>
next()
}
async function parseMultipart(req: Request, _res: Response, next: NextFunction) {
try {
const [, files] = await formidable().parse(req)
;(req as any).files = files // Record<string, File[]>
next()
} catch (err) {
next(err)
}
}

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

해당 예시는 단순히 다른 라이브러리를 사용할 때 예시를 나타내기 위함입니다. 사용자가 사용하는 express 버전이나 커스텀 특징에 따라 변화될 수 있기 때문에 리뷰를 반영하지 않습니다.

Comment thread README.md Outdated
@yuchem2
yuchem2 requested a review from laggu July 15, 2026 08:28
@yuchem2
yuchem2 merged commit 31bcd97 into develop Jul 16, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants