You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
add-video/add-audio: silent skip on filename collision in assets dir (no warning) #37
addVideo (and likely addAudio) in src/factory.ts copies source files into assets/video/<basename> using only the file's basename, and skips the copy
if the destination already exists:
If two different source files share the same basename (e.g. en/0_00.png
and jp/0_00.png), the second one added is silently skipped — the draft
ends up pointing at the wrong file's content, with no error or warning.
Expected behavior
I understand the reasoning behind skipping the copy when the destination
already exists (avoids redundant copies). But when the skip happens because
of a different source file resolving to the same destination filename,
the CLI should print a warning to the console, e.g.:
Warning: "assets/video/0_00.png" already exists from a different source
file; skipping copy. The draft may reference stale content.
This would make the collision visible instead of silently producing a
draft with the wrong media.
Thanks — great catch, and you're right that it hits addAudio too, not just addVideo.
One nuance on the fix: the skip-on-exists is intentional (the Wikimedia fetch path pre-writes into assets/<kind> so the later copy is a deliberate no-op, and re-adding the same file mustn't re-copy). So rather than warn-only — which surfaces the collision but still leaves the draft pointing at stale content — I made it content-aware:
existing file is byte-identical → keep the silent no-op
a different source resolving to the same basename → write it under a content-hashed name (0_00.<sha1-8>.png) and warn on stderr
That way the draft ends up referencing the correct content, not just flagged.
Fix + tests in #38. Thanks again for the precise repro and code pointer — made this a quick one.
Activity
renezander030 commentedon Jul 2, 2026
Thanks — great catch, and you're right that it hits
addAudiotoo, not justaddVideo.One nuance on the fix: the skip-on-exists is intentional (the Wikimedia fetch path pre-writes into
assets/<kind>so the later copy is a deliberate no-op, and re-adding the same file mustn't re-copy). So rather than warn-only — which surfaces the collision but still leaves the draft pointing at stale content — I made it content-aware:0_00.<sha1-8>.png) and warn on stderrThat way the draft ends up referencing the correct content, not just flagged.
Fix + tests in #38. Thanks again for the precise repro and code pointer — made this a quick one.
naoyashiga commentedon Jul 2, 2026
Thank you for the quick fix!
renezander030 commentedon Jul 2, 2026
No worries. This is a team effort. Bring in patches as you spot them!