Repository navigation
Conversation
There was a problem hiding this comment.
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.
| async function parseMultipart(req: Request, _res: Response, next: NextFunction) { | ||
| const [, files] = await formidable().parse(req) | ||
| ;(req as any).files = files // Record<string, File[]> | ||
| next() | ||
| } |
There was a problem hiding this comment.
Express 4 이하 버전에서는 비동기(async) 미들웨어 내부에서 에러가 발생했을 때 try/catch 블록으로 감싸서 next(err)를 호출하지 않으면, 에러가 Express 에러 핸들러로 전달되지 않고 요청이 무한 대기(hang) 상태에 빠지거나 프로세스가 종료될 수 있습니다.
가이드 문서의 예제 코드에서도 안전하게 에러를 처리할 수 있도록 try/catch 블록을 추가하는 것을 권장합니다.
| 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) | |
| } | |
| } |
There was a problem hiding this comment.
해당 예시는 단순히 다른 라이브러리를 사용할 때 예시를 나타내기 위함입니다. 사용자가 사용하는 express 버전이나 커스텀 특징에 따라 변화될 수 있기 때문에 리뷰를 반영하지 않습니다.
multipart/form-data에 대한 지원이 추가되면서 해당 데코레이터를 사용하는 가이드 문서를 추가합니다.