Skip to content

fix(approvals): keep argument previews within their original size - #306

Merged
primoco merged 1 commit into
eullm:mainfrom
Gabriele06-local:fix/approval-preview-size
Nov 20, 2026
Merged

primoco merged 1 commit into
eullm:mainfrom
Gabriele06-local:fix/approval-preview-size

Conversation

@Gabriele06-local

Copy link
Copy Markdown
Contributor

preview_arguments() truncated a long string to 2000 bytes and then appended an … [N bytes] suffix, making the preview longer than the original value (and inserting U+FFFD when the cut landed mid-character). The suffix length is now reserved before truncating, so the preview never exceeds the input and starts at a valid UTF-8 boundary. Unit test covers a 2001-byte ASCII string and a multi-byte one.

Verification: cargo fmt --check, cargo clippy -- -D warnings, cargo test --lib approvals::tests — 1 passed.

I have read and agree to the Contributor Licence Agreement in CLA.md.

@primoco
primoco merged commit 1ec5177 into eullm:main Nov 20, 2026
4 checks passed
@primoco

primoco commented Nov 20, 2026

Copy link
Copy Markdown
Contributor

Merged, thanks!

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.

2 participants