Skip to content

Commit c6beede

Browse files
SimoMayclaude
andcommitted
fix(build): strip leading .. from additionalFiles paths on Windows
findFilesByMatchers split relative() output on "/", but on Windows relative() returns backslash paths, so no ".." segment was removed and matched files were copied outside the build directory. Split on the platform separator instead. Fixes #5074 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
1 parent fc33769 commit c6beede

2 files changed

Lines changed: 7 additions & 2 deletions

File tree

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@trigger.dev/build": patch
3+
---
4+
5+
`additionalFiles` now strips leading `..` segments on Windows too, so a pattern like `../shared/**` copies files inside the build instead of outside it.

‎packages/build/src/internal/copyFiles.ts‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { cp, copyFile, mkdir } from "node:fs/promises";
2-
import { dirname, join, posix, relative } from "node:path";
2+
import { dirname, join, posix, relative, sep } from "node:path";
33
import { glob } from "tinyglobby";
44

55
/**
@@ -44,7 +44,7 @@ export async function findFilesByMatchers(
4444

4545
const assets: CopyPair[] = files.map((file) => {
4646
const pathInsideDestinationDir = relative(cwd, file)
47-
.split(posix.sep)
47+
.split(sep)
4848
.filter((p) => p !== "..")
4949
.join(posix.sep);
5050
return {

0 commit comments

Comments
 (0)