fix: 노션 복붙 본문 유실 방지#609
Conversation
Co-authored-by: OmX <omx@oh-my-codex.dev>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
📝 Walkthrough전체 요약클립보드에서 순수 이미지 데이터를 정확히 판별하기 위해 새로운 유틸리티 함수 변경 사항클립보드 이미지 전용 판별 및 적용
예상 코드 리뷰 난이도🎯 2 (Simple) | ⏱️ ~10 분 시
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@src/components/common/ui/editor/clipboard-utils.ts`:
- Around line 13-14: The regex DATA_IMAGE_TEXT_PART currently allows trailing
whitespace/letters and can overmatch plain text; update it to only match the
data URI base64 block by removing the trailing `\s` and preventing extra
characters—e.g. change to a pattern like
`data:image\/[a-z0-9.+-]+;base64,[A-Za-z0-9+/=]+(?![A-Za-z0-9+/=])` (preserve
flags) so isClipboardImageOnly and the subsequent cleanup logic only detect pure
image data and do not strip mixed text; ensure the updated DATA_IMAGE_TEXT_PART
constant is used where isClipboardImageOnly and the cleaning flow reference it.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: 26db48ae-e2b9-4d28-8e0e-d9e1e305b1f9
📒 Files selected for processing (2)
src/components/common/ui/editor/clipboard-utils.tssrc/components/common/ui/editor/markdown-editor.tsx
| const DATA_IMAGE_TEXT_PART = | ||
| /data:image\/[a-z0-9.+-]+;base64,[a-zA-Z0-9+/=\s]+/gi; |
There was a problem hiding this comment.
data:image 텍스트 패턴이 일반 본문까지 함께 제거할 수 있습니다.
현재 정규식은 Base64 뒤 일반 영문 텍스트도 매칭해 isClipboardImageOnly가 오판할 수 있습니다. Line 136-140 정제 로직과 결합되면 혼합 붙여넣기 본문 유실이 다시 발생할 수 있습니다.
수정 제안
-const DATA_IMAGE_TEXT_PART =
- /data:image\/[a-z0-9.+-]+;base64,[a-zA-Z0-9+/=\s]+/gi;
+const DATA_IMAGE_TEXT_PART =
+ /data:image\/[a-z0-9.+-]+;base64,[a-zA-Z0-9+/=]+/gi;📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| const DATA_IMAGE_TEXT_PART = | |
| /data:image\/[a-z0-9.+-]+;base64,[a-zA-Z0-9+/=\s]+/gi; | |
| const DATA_IMAGE_TEXT_PART = | |
| /data:image\/[a-z0-9.+-]+;base64,[a-zA-Z0-9+/=]+/gi; |
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@src/components/common/ui/editor/clipboard-utils.ts` around lines 13 - 14, The
regex DATA_IMAGE_TEXT_PART currently allows trailing whitespace/letters and can
overmatch plain text; update it to only match the data URI base64 block by
removing the trailing `\s` and preventing extra characters—e.g. change to a
pattern like `data:image\/[a-z0-9.+-]+;base64,[A-Za-z0-9+/=]+(?![A-Za-z0-9+/=])`
(preserve flags) so isClipboardImageOnly and the subsequent cleanup logic only
detect pure image data and do not strip mixed text; ensure the updated
DATA_IMAGE_TEXT_PART constant is used where isClipboardImageOnly and the
cleaning flow reference it.
Summary
Verification
Summary by CodeRabbit
릴리스 노트