Skip to content

이미지 업로드 정규화 및 유틸 정리#695

Merged
HA-SEUNG-JEONG merged 3 commits into
developfrom
fix/image-key
May 25, 2026
Merged

이미지 업로드 정규화 및 유틸 정리#695
HA-SEUNG-JEONG merged 3 commits into
developfrom
fix/image-key

Conversation

@HA-SEUNG-JEONG
Copy link
Copy Markdown
Contributor

Problem

QA 답변 이미지 업로드 시 normalizeImageFileForUpload가 적용되지 않아 MIME 타입·확장자가 올바르게 처리되지 않는 문제가 있었습니다.

또한 stripHtml이 페이지마다 별도 구현되어 있었고, IMAGE_MIME_TO_EXT / IMAGE_MIME_TO_EXTS 두 개의 중복 레지스트리가 공존하고 있었습니다.

Solution

  • QA 페이지 이미지 업로드 핸들러에 normalizeImageFileForUpload 적용 (파일 정규화 후 업로드 + preview URL 생성)
  • stripHtmlsrc/utils/markdown-content-text.ts에 공용 export로 추출, 각 페이지의 로컬 구현 제거
  • IMAGE_MIME_TO_EXT 삭제 — IMAGE_MIME_TO_EXTS를 단일 레지스트리로 통합, HEIC 감지 로직 분기 단순화

Changes

Bug Fixes

File Description
src/app/(landing)/class/[slug]/(learning)/qa/[id]/page.tsx 이미지 업로드 시 normalizeImageFileForUpload 적용
src/components/common/ui/editor/image-utils.ts IMAGE_MIME_TO_EXT 제거, IMAGE_MIME_TO_EXTS 단일 레지스트리로 통합, HEIC 분기 단순화
src/utils/markdown-content-text.ts stripHtml 공용 export 추가
src/app/(landing)/class/[slug]/(learning)/feed/[id]/page.tsx 로컬 stripHtml → 공용 util 교체, 미사용 import 제거
src/app/(landing)/class/[slug]/(learning)/qa/[id]/page.tsx 로컬 stripHtml 함수 제거 → 공용 util 사용

Result

  • QA 이미지 업로드 시 MIME 타입 정규화·HEIC 변환이 일관되게 적용됨
  • stripHtml 로직이 단일 구현으로 통합되어 동작 일관성 확보
  • IMAGE_MIME_TO_EXT 중복 제거로 확장자 레지스트리 유지보수 지점 단일화

Test plan

  • QA 페이지에서 JPEG/PNG/WEBP 이미지 업로드 후 preview 및 서버 키 정상 확인
  • QA 페이지에서 HEIC 이미지 업로드 시 JPEG 변환 후 업로드 확인
  • 피드 상세 페이지에서 HTML 태그가 포함된 댓글 내용이 텍스트만 렌더링되는지 확인
  • QA 상세 페이지에서 동일하게 stripHtml 적용 결과 확인

🤖 Generated with Claude Code

HA-SEUNG-JEONG and others added 3 commits May 25, 2026 10:46
…_MIME_TO_EXTS 단일 레지스트리로 통합

- IMAGE_MIME_TO_EXT 삭제 (IMAGE_MIME_TO_EXTS[mime][0] 중복)
- getExtensionFromMime: IMAGE_MIME_TO_EXTS[mime][0] 참조로 변경
- toImageInputAccept: exts.some() 로 alias 확장자(jpeg 등) 포함 MIME 매칭

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
… 공용 함수로 교체

- lesson-qna, qa 페이지 이미지 업로드에 normalizeImageFileForUpload 적용
- qa 페이지 로컬 stripHtml 함수 제거, 공용 유틸로 교체
- feed 페이지도 공용 stripHtml 사용

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@vercel
Copy link
Copy Markdown

vercel Bot commented May 25, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
study-platform-client-dev Ready Ready Preview, Comment May 25, 2026 2:34am

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 25, 2026

Warning

Review limit reached

@HA-SEUNG-JEONG, we couldn't start this review because you've used your available PR reviews for now.

Your plan includes 1 review of capacity. Refill in 30 minutes and 49 seconds.

Your organization has run out of usage credits. Purchase more in the billing tab.

⌛ How to resolve this issue?

After more review capacity refills, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than trial, open-source, and free plans. In all cases, review capacity refills continuously over time.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 829556c0-1959-4b55-8e2b-a2460e287ca6

📥 Commits

Reviewing files that changed from the base of the PR and between 87b0fae and 6c1a583.

📒 Files selected for processing (5)
  • src/app/(class-lesson)/class/[slug]/lesson/[id]/_components/lesson-qna-submission-modal.tsx
  • src/app/(landing)/class/[slug]/(learning)/feed/[id]/page.tsx
  • src/app/(landing)/class/[slug]/(learning)/qa/[id]/page.tsx
  • src/components/common/ui/editor/image-utils.ts
  • src/utils/markdown-content-text.ts
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/image-key

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@HA-SEUNG-JEONG HA-SEUNG-JEONG self-assigned this May 25, 2026
@HA-SEUNG-JEONG HA-SEUNG-JEONG merged commit f4e418f into develop May 25, 2026
13 checks passed
@HA-SEUNG-JEONG HA-SEUNG-JEONG deleted the fix/image-key branch May 25, 2026 02:49
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.

1 participant