cherry-studio/packages
SuYao 76ee67d4d7
fix: prevent OOM when handling large base64 image data (#12244)
* fix: prevent OOM when handling large base64 image data

- Add memory-safe parseDataUrl utility using string operations instead of regex
- Truncate large base64 data in ErrorBlock detail modal to prevent freezing
- Update ImageViewer, FileStorage, messageConverter to use shared parseDataUrl
- Deprecate parseDataUrlMediaType in favor of shared utility
- Add GB support to formatFileSize
- Add comprehensive unit tests for parseDataUrl (18 tests)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>

* refactor: simplify parseDataUrl API to return DataUrlParts | null

- Change return type from discriminated union to simple nullable type
- Update all call sites to use optional chaining (?.)
- Update tests to use toBeNull() for failure cases
- More idiomatic and consistent with codebase patterns (e.g., parseJSON)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>

---------

Co-authored-by: Claude <noreply@anthropic.com>
2026-01-06 00:34:14 +08:00
..
ai-sdk-provider refactor: switch yarn to pnpm (#12260) 2026-01-05 22:16:34 +08:00
aiCore refactor: switch yarn to pnpm (#12260) 2026-01-05 22:16:34 +08:00
extension-table-plus refactor: switch yarn to pnpm (#12260) 2026-01-05 22:16:34 +08:00
mcp-trace chore[lint]: add import type lint (#11091) 2025-11-01 10:40:02 +08:00
shared fix: prevent OOM when handling large base64 image data (#12244) 2026-01-06 00:34:14 +08:00