Skip to content

add-video/add-audio: silent skip on filename collision in assets dir (no warning) #37

Description

@naoyashiga

Summary

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:

const filename = basename(opts.path) || "media";
const destPath = resolve(assetsDir, filename);
if (!existsSync(destPath)) {
  copyFileSync(opts.path, destPath);
}

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.

Repro

  1. capcut add-video <project> path/to/jp/0_00.png 0s 7s
  2. capcut add-video <project> path/to/en/0_00.png 0s 7s
  3. The second segment's material ends up pointing at the jp image content,
    with no warning printed.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions