From c6beeded5fd9b520c32eae4fdd8ee1628d9c3120 Mon Sep 17 00:00:00 2001 From: Mo <1516966+SimoMay@users.noreply.github.com> Date: Mon, 26 Oct 2026 12:04:11 +0100 Subject: [PATCH] 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 --- .changeset/additional-files-windows.md | 5 +++++ packages/build/src/internal/copyFiles.ts | 4 ++-- 2 files changed, 7 insertions(+), 2 deletions(-) create mode 100644 .changeset/additional-files-windows.md diff --git a/.changeset/additional-files-windows.md b/.changeset/additional-files-windows.md new file mode 100644 index 00000000000..07b11122a0e --- /dev/null +++ b/.changeset/additional-files-windows.md @@ -0,0 +1,5 @@ +--- +"@trigger.dev/build": patch +--- + +`additionalFiles` now strips leading `..` segments on Windows too, so a pattern like `../shared/**` copies files inside the build instead of outside it. diff --git a/packages/build/src/internal/copyFiles.ts b/packages/build/src/internal/copyFiles.ts index 6fd3ede9545..79a29706324 100644 --- a/packages/build/src/internal/copyFiles.ts +++ b/packages/build/src/internal/copyFiles.ts @@ -1,5 +1,5 @@ import { cp, copyFile, mkdir } from "node:fs/promises"; -import { dirname, join, posix, relative } from "node:path"; +import { dirname, join, posix, relative, sep } from "node:path"; import { glob } from "tinyglobby"; /** @@ -44,7 +44,7 @@ export async function findFilesByMatchers( const assets: CopyPair[] = files.map((file) => { const pathInsideDestinationDir = relative(cwd, file) - .split(posix.sep) + .split(sep) .filter((p) => p !== "..") .join(posix.sep); return {