Skip to content

Commit e6ccab9

Browse files
fix(cli): init transcodes an in-folder .MP4 beside it on case-insensitive disks too
original.MP4 and original.mp4 are one file on macOS and Windows, so the same-file check now ignores case. The test's ffprobe call gets its --.
1 parent 43aa627 commit e6ccab9

2 files changed

Lines changed: 7 additions & 6 deletions

File tree

‎packages/cli/src/commands/init.sourceInFolder.test.ts‎

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ const encode = (out: string, codec: string[]) =>
3232
const codecOf = (file: string) =>
3333
execFileSync("ffprobe", [
3434
...["-v", "error", "-select_streams", "v:0", "-show_entries", "stream=codec_name"],
35-
...["-of", "csv=p=0", file],
35+
...["-of", "csv=p=0", "--", file],
3636
])
3737
.toString()
3838
.trim();
@@ -100,10 +100,11 @@ it.skipIf(!ffmpeg).each(["index.html", "meta.json", "AGENTS.md"])(
100100
},
101101
);
102102

103-
it.skipIf(!hevc)(
104-
"transcodes an HEVC .mp4 already in the folder beside it, keeping the original",
105-
async () => {
106-
const source = join(project, "original.mp4");
103+
it.skipIf(!hevc).each(["original.mp4", "original.MP4"])(
104+
"transcodes an HEVC %s already in the folder beside it, keeping the original",
105+
async (name) => {
106+
rmSync(join(project, "original.mp4"));
107+
const source = join(project, name);
107108
encode(source, ["-c:v", "libx265", "-tag:v", "hvc1"]);
108109
const video = readFileSync(source);
109110
await initWithVideo(source, false);

‎packages/cli/src/commands/init.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -509,7 +509,7 @@ async function handleVideoFile(
509509
if (shouldTranscode) {
510510
const sameName = localVideoName.replace(/\.[^.]+$/, ".mp4");
511511
const mp4Name =
512-
resolve(destDir, sameName) === resolve(videoPath)
512+
resolve(destDir, sameName).toLowerCase() === resolve(videoPath).toLowerCase()
513513
? sameName.replace(/\.mp4$/, ".h264.mp4")
514514
: sameName;
515515
const mp4Path = resolve(destDir, mp4Name);

0 commit comments

Comments
 (0)