Skip to content

fix: avoid utf8 panic in file preview#277

Open
Bortlesboat wants to merge 1 commit into
CortexLM:mainfrom
Bortlesboat:fix/write-file-utf8-preview
Open

fix: avoid utf8 panic in file preview#277
Bortlesboat wants to merge 1 commit into
CortexLM:mainfrom
Bortlesboat:fix/write-file-utf8-preview

Conversation

@Bortlesboat
Copy link
Copy Markdown

Fixes PlatformNetwork/bounty-challenge#53262.

What changed:

  • app-server write_file metadata preview now truncates by Unicode scalar count instead of slicing at byte index 500.
  • Added a regression test with a multi-byte character crossing the old byte boundary.

Verification:

  • cargo test -p cortex-app-server write_file_content_preview_truncates_on_utf8_boundary_without_panic -- --nocapture
  • cargo test -p cortex-app-server --lib -- --skip tools::shell::tests::test_execute_shell
  • cargo check -p cortex-app-server
  • cargo fmt --check --package cortex-app-server
  • git diff --check

Note: the skipped app-server lib test is the existing Windows-only shell test that expects echo as an executable.

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

1 participant