Skip to content

fix: prevent panic on UTF-8 multi-byte characters in slice preview#230

Open
x19216888-stack wants to merge 1 commit intoCortexLM:mainfrom
x19216888-stack:fix-utf8-panic
Open

fix: prevent panic on UTF-8 multi-byte characters in slice preview#230
x19216888-stack wants to merge 1 commit intoCortexLM:mainfrom
x19216888-stack:fix-utf8-panic

Conversation

@x19216888-stack
Copy link
Copy Markdown

Description

cortex import panics with byte index is not a char boundary if a multi-byte UTF-8 character appears exactly around the 200-byte error preview truncation mark. This PR changes the slice truncation to evaluate against chars().take(200) correctly.

Bounty Eligibility

Verification

Generated test file with e-acute (U+00E9) crossing the 200th byte and ran cortex import. The process correctly delegates gracefully to the JSON parser output instead of process abortation (core dumped).

Copy link
Copy Markdown

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Your free trial has ended. If you'd like to continue receiving code reviews, you can add a payment method here.

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.

cortex import panics with 'byte index is not a char boundary' when file contains UTF-8 chars near 200-byte mark

1 participant