fix(batch): index the name template by character - #243
Merged
Merged
Conversation
53 tasks
LeadcodeDev
force-pushed
the
fix/watch-cache-invalidation
branch
from
September 22, 2026 06:10
408d3e4 to
a7a75fa
Compare
LeadcodeDev
force-pushed
the
fix/batch-template-unicode
branch
from
September 22, 2026 06:10
4c04f06 to
8d6a272
Compare
LeadcodeDev
force-pushed
the
fix/watch-cache-invalidation
branch
from
September 22, 2026 08:34
a7a75fa to
581d1ad
Compare
LeadcodeDev
force-pushed
the
fix/batch-template-unicode
branch
from
September 22, 2026 08:34
8d6a272 to
3d27c42
Compare
LeadcodeDev
force-pushed
the
fix/watch-cache-invalidation
branch
from
September 22, 2026 08:44
581d1ad to
b02296e
Compare
LeadcodeDev
force-pushed
the
fix/batch-template-unicode
branch
from
September 22, 2026 08:44
3d27c42 to
87baa16
Compare
LeadcodeDev
changed the base branch from
fix/watch-cache-invalidation
to
chantier/audit-2026-09
September 22, 2026 08:53
LeadcodeDev
force-pushed
the
fix/batch-template-unicode
branch
from
September 22, 2026 09:00
87baa16 to
f210262
Compare
`resolve_name_template` walks the template as raw bytes and casts each one to `char`, which in Rust is a Latin-1 reinterpretation of the byte value. Substituted `{field}` values are fine (they go through `push_str` at line 71); the literal text around them is not. I confirmed the behaviour by compiling the same loop standalone: `résumé-{id}.mp4` yields `résumé-VAL.mp4` and `动画-{id}.mp4` yields `å¨ç»-VAL.mp4`. So `rustmotion batch --name-template "résumé-{id}.mp4"` writes files literally named `résumé-abc.mp4` to disk, and the same corruption lands in the `[ok] <path>` progress lines and in every failure message (`item N: ...`). A localisation batch — the exact use case `{lang}/{id}.mp4` in the module doc is built for — is where a non-ASCII template is most likely. None of the five tests in `name_template_tests` (lines 448-495) uses a non-ASCII template.
Refs #220
LeadcodeDev
force-pushed
the
fix/batch-template-unicode
branch
from
September 22, 2026 09:05
f210262 to
72c5ac4
Compare
LeadcodeDev
added a commit
that referenced
this pull request
Sep 22, 2026
`resolve_name_template` walks the template as raw bytes and casts each one to `char`, which in Rust is a Latin-1 reinterpretation of the byte value. Substituted `{field}` values are fine (they go through `push_str` at line 71); the literal text around them is not. I confirmed the behaviour by compiling the same loop standalone: `résumé-{id}.mp4` yields `résumé-VAL.mp4` and `动画-{id}.mp4` yields `å¨ç»-VAL.mp4`. So `rustmotion batch --name-template "résumé-{id}.mp4"` writes files literally named `résumé-abc.mp4` to disk, and the same corruption lands in the `[ok] <path>` progress lines and in every failure message (`item N: ...`). A localisation batch — the exact use case `{lang}/{id}.mp4` in the module doc is built for — is where a non-ASCII template is most likely. None of the five tests in `name_template_tests` (lines 448-495) uses a non-ASCII template.
Refs #220
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Severity Low, category correctness. Location:
crates/rustmotion/src/cli/commands/batch.rs:74Impact
resolve_name_templatewalks the template as raw bytes and casts each one tochar, which in Rust is a Latin-1 reinterpretation of the byte value. Substituted{field}values are fine (they go throughpush_strat line 71); the literal text around them is not. I confirmed the behaviour by compiling the same loop standalone:résumé-{id}.mp4yieldsrésumé-VAL.mp4and动画-{id}.mp4yieldså¨ç»-VAL.mp4. Sorustmotion batch --name-template "résumé-{id}.mp4"writes files literally namedrésumé-abc.mp4to disk, and the same corruption lands in the[ok] <path>progress lines and in every failure message (item N: ...). A localisation batch — the exact use case{lang}/{id}.mp4in the module doc is built for — is where a non-ASCII template is most likely. None of the five tests inname_template_tests(lines 448-495) uses a non-ASCII template.Fix
Iterate
template.char_indices()instead of the byte array, pushing thecharitself and advancing byc.len_utf8(); the{/}scanning already works on byte offsets that are guaranteed char boundaries, so only the else-arm changes. Add a test assertingresolve_name_template("résumé-{id}.mp4", ...)round-trips the accents.Evidence the audit read
Part of the September 2026 audit remediation chantier. Refs #220 (RM-30).