You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* fix: handle UTF BOM in config files
- Remove UTF-8 BOM (ef bb bf) from config files before parsing
- Throw descriptive errors for other BOMs (UTF-16, UTF-32)
- Add comprehensive tests for BOM handling in TOML and JSON configs
Fixes#9938
Co-Authored-By: [email protected] <[email protected]>
* refactor: use array-based approach for BOM detection
- Replace individual BOM constants with UNSUPPORTED_BOMS array
- Use loop instead of separate if statements for each BOM type
- Reduces code duplication while maintaining exact same functionality
Addresses PR feedback from vicb
Co-Authored-By: [email protected] <[email protected]>
* refactor: decode buffer first, then check for BOM codepoints
- Use TextDecoder().decode() first, which automatically strips UTF-8 BOMs
- Check for UTF-16/UTF-32 BOMs as replacement characters in decoded string
- Fall back to raw buffer inspection to determine specific BOM type
- Cleaner approach as suggested by user feedback
- All existing tests continue to pass
Co-Authored-By: [email protected] <[email protected]>
* fix: revert to hybrid BOM detection approach
- TextDecoder().decode() first to automatically strip UTF-8 BOMs
- Check for replacement characters to detect non-UTF-8 BOMs
- Fall back to raw buffer inspection for specific BOM type identification
- All BOM tests pass (UTF-8 removal, UTF-16/UTF-32 error detection)
- Constant string approach not viable as all non-UTF-8 BOMs decode identically
Co-Authored-By: [email protected] <[email protected]>
* fix: resolve formatting issues in BOM handling code
- Apply prettier formatting to parse.ts
- No functional changes to BOM detection logic
- All BOM tests continue to pass locally
Co-Authored-By: [email protected] <[email protected]>
* simplify bom validation
* refactor: address PR feedback - use Buffer.concat for UTF-8 BOM tests and array-based BOM detection
- Update UTF-8 BOM tests to use Buffer.concat([Buffer.from([0xEF, 0xBB, 0xBF]), Buffer.from(configContent, 'utf-8')]) as suggested by petebacondarwin
- Revert to array-based BOM detection approach with collapsed properties (name + encoding) as suggested by vicb
- Maintain all existing functionality while following preferred patterns
Co-Authored-By: [email protected] <[email protected]>
* tweak file type
* refactor: simplify UNSUPPORTED_BOMS array to use only encoding property
Co-Authored-By: [email protected] <[email protected]>
* fix: resolve formatting issues in BOM handling implementation
Co-Authored-By: [email protected] <[email protected]>
---------
Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Co-authored-by: [email protected] <[email protected]>
0 commit comments