Skip to content

fix(cli): make mcp url truncation utf8 safe#353

Open
OnlyYu1996 wants to merge 1 commit into
CortexLM:mainfrom
OnlyYu1996:fix-mcp-url-utf8-truncation
Open

fix(cli): make mcp url truncation utf8 safe#353
OnlyYu1996 wants to merge 1 commit into
CortexLM:mainfrom
OnlyYu1996:fix-mcp-url-utf8-truncation

Conversation

@OnlyYu1996
Copy link
Copy Markdown

Summary

  • replace raw byte-index truncation in MCP list/auth display with a UTF-8 safe helper
  • preserve the existing ASCII display widths for MCP HTTP URLs, auth-list URLs, and stdio commands
  • cover short strings, legacy ASCII truncation lengths, UTF-8 boundary safety, and tiny-width handling

Bounty issues:

Validation

  • cargo +stable fmt --package cortex-cli --check
  • cargo +stable test --package cortex-cli mcp_cmd::tests:: -- --nocapture (4 passed)
  • cargo +stable test --package cortex-cli mcp_cmd:: -- --nocapture (194 passed)
  • cargo +stable check --package cortex-cli --lib
  • cargo +stable build --package cortex-cli --bin Cortex
  • git diff --check

Note: an end-to-end debug-binary smoke for mcp list / mcp auth list is blocked on current main by the existing clap debug assertion Command mcp: command ls alias ls is duplicated before command dispatch. The UTF-8 truncation behavior is covered in unit tests and the binary still builds successfully.

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.

1 participant