[fix] photo upload body limit + shared client preflight#44
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
제보고 된 버그
1 MB 쇬 넘는 JPG 를 단체사진으로 올리면 prod 에서
Application error(digest4028661507) 가 떴던 현상. 서버 로그로 원인 확정:즉 우리 코드의
MAX_UPLOAD_BYTES = 15MB검증까지 도달하지 못하고 Next Server Actions 기본 1 MB 제한에 먼저 잡혐다.수정
next.config.ts에experimental.serverActions.bodySizeLimit: "20mb"추가. 우리 상한(15MB) + multipart overhead 마진.lib/upload-limits.ts신규 — client/server 둘 다 import 가능한 pure 상수(MAX_UPLOAD_BYTES,ALLOWED_MIME_TYPES) + preflight 헬퍼(checkUploadFile). 기존lib/uploads.ts는 이 모듈에서 re-export + 내부에서 사용.PhotoSection.tsx/PhotoReplaceButton.tsx에 client preflight 추가. 파일 선택 단계에서 size/MIME 를 검사해 통과 못하면 server action 호출 자체를 안 한다 — generic 413 차단 + 빠른 inline 알림.photo-actions.ts교체 — 동일한checkUploadFile을 server-side 에서도 다시 수행 (defense in depth, client preflight 우회 대비).잘이니 버그 점검
같은 종류의 잠재 버그(framework 기본 limit 에 걸리는 경우)가 다른 server action 에 있는지 확인:
createSession(notes 최대 2000자 = ~4KB) — 안전.upsertParticipation(note 500자) — 안전.approveUser/rejectUser— userId 하나. 안전.uploadSessionPhoto/removeSessionPhoto— 본 PR 에서 수정.즉 1 MB 경계에 걸리는 server action 은 사진 업로드 둘 뿐이고, 둔 PR 에서 모두 고쳐짐.
middleware 쪽은 이미 #43 에서
/adminEdge 차단 제거 + page-levelrequireAdmin()에서 최종 판정 하도록 정리됨. stale token 가능성이 있던/admin/*점검 걹처가 이제 없음.머릿속 검증
문서 보강
.gjc/skills/murun-feature/SKILL.md§4.5 에 파일 업로드 체크리스트 추가 (bodySizeLimit + client preflight + defense in depth + 공유 상수).docs/wiki/06-Checkpoints.md£7 에 "파일 업로드 framework limit 경계" 항목 추가.검증
pnpm check통과..env.prod에 추가 설정 필요 없음).