Skip to content

fix(vmm): truncate a one-shot compose preview by character, not by byte - #1362

Merged
kvinwang merged 2 commits into
nextfrom
fix/vmm-compose-preview-utf8
Sep 24, 2026
Merged

kvinwang merged 2 commits into
nextfrom
fix/vmm-compose-preview-utf8

Conversation

@kvinwang

@kvinwang kvinwang commented Sep 24, 2026 •

Copy link
Copy Markdown
Collaborator

Problem

one_shot.rs did &compose_file[..200] for its error message. If byte 200 falls inside a multi-byte character, --one-shot panics:

byte index 200 is not a char boundary; it is inside '中' (bytes 198..201)

Fix

compose_preview truncates by character and replaces both copies of the expression.

Verification

cargo test -p dstack-vmm compose_preview, fmt and clippy clean.

Split out of #1282.

@kvinwang
kvinwang merged commit dc7925f into next Sep 24, 2026
11 checks passed
@kvinwang
kvinwang deleted the fix/vmm-compose-preview-utf8 branch September 24, 2026 14:25
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