Title: bug: additionalFiles copies ../ matches outside the build on Windows · Issue #5074 · triggerdotdev/trigger.dev · GitHub
Open Graph Title: bug: additionalFiles copies ../ matches outside the build on Windows · Issue #5074 · triggerdotdev/trigger.dev
X Title: bug: additionalFiles copies ../ matches outside the build on Windows · Issue #5074 · triggerdotdev/trigger.dev
Description: Provide environment information OS: Windows (fails); macOS and Linux are not affected trigger.dev CLI and @trigger.dev/build: 4.5.16 The same code is in 4.8.1 and on main Describe the bug additionalFiles is meant to strip leading .. segm...
Open Graph Description: Provide environment information OS: Windows (fails); macOS and Linux are not affected trigger.dev CLI and @trigger.dev/build: 4.5.16 The same code is in 4.8.1 and on main Describe the bug additiona...
X Description: Provide environment information OS: Windows (fails); macOS and Linux are not affected trigger.dev CLI and @trigger.dev/build: 4.5.16 The same code is in 4.8.1 and on main Describe the bug additiona...
Opengraph URL: https://github.com/triggerdotdev/trigger.dev/issues/5074
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"bug: additionalFiles copies ../ matches outside the build on Windows","articleBody":"## Provide environment information\n\n- OS: Windows (fails); macOS and Linux are not affected\n- `trigger.dev` CLI and `@trigger.dev/build`: 4.5.16\n- The same code is in 4.8.1 and on `main`\n\n## Describe the bug\n\n`additionalFiles` is meant to strip leading `..` segments so that a pattern like `../shared/**` copies files inside the build output. On Windows the segments are not stripped, and the files are copied outside the build directory. The deploy goes ahead without them.\n\nThe cause is `findFilesByMatchers` in `packages/build/src/internal/copyFiles.ts`:\n\n```ts\nconst pathInsideDestinationDir = relative(cwd, file)\n .split(posix.sep)\n .filter((p) => p !== \"..\")\n .join(posix.sep);\n```\n\nOn Windows, `relative()` returns a backslash path (`..\\shared\\a.md`). Splitting on `/` gives one segment, so no `..` is removed, and `join(destinationDir, \"..\\shared\\a.md\")` resolves outside the build directory, one level up for each `..`.\n\nExpected: the files land at `\u003cbuild>/shared/a.md` on every OS, as they do on macOS and Linux.\n\n## Reproduction repo\n\nNo repo needed. The Node script below runs the same path logic with `path.win32`, on any OS.\n\n## To reproduce\n\n```js\nconst { win32, posix } = require(\"node:path\");\nconst cwd = \"C:\\\\repo\\\\app\";\nconst file = \"C:\\\\repo\\\\shared\\\\a.md\";\nconst dest = \"C:\\\\repo\\\\app\\\\.trigger\\\\tmp\\\\build-x\";\n\nconst inside = win32.relative(cwd, file).split(posix.sep).filter((p) => p !== \"..\").join(posix.sep);\nconsole.log(win32.join(dest, inside));\n// C:\\repo\\app\\.trigger\\tmp\\shared\\a.md \u003c- outside build-x\n```\n\nEnd to end, on Windows:\n\n1. In a project one level below the repo root, add `additionalFiles({ files: [\"../shared/**\"] })` to `trigger.config.ts`.\n2. Run `npx trigger.dev deploy`.\n3. The deployed image has no `shared/` folder. The same deploy from macOS includes it.\n\nA task that reads one of those files at runtime then fails with a missing file.\n\n## Suggested fix\n\nSplit on the platform separator, and keep joining with `/` (`join` accepts it on Windows):\n\n```ts\nconst pathInsideDestinationDir = relative(cwd, file)\n .split(sep)\n .filter((p) => p !== \"..\")\n .join(posix.sep);\n```\n\nWith `path.win32` and `path.posix`, both resolve to `\u003cbuild>/shared/a.md`. A PR with this change follows.\n","author":{"url":"https://github.com/SimoMay","@type":"Person","name":"SimoMay"},"datePublished":"2026-10-26T11:03:35Z","url":"https://github.com/triggerdotdev/trigger.dev/issues/5074"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react-reconciler,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@d5750093facf |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:6fb5966d-c0af-4c14-0694-949ded717eaa |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | AC06:268853:5F51571:7E999C2:6AFAD880 |
| html-safe-nonce | 89a2f364654abd7ac5b3d8d6bfce8353b52095462fd7d74590587d83a7749385 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJBQzA2OjI2ODg1Mzo1RjUxNTcxOjdFOTk5QzI6NkFGQUQ4ODAiLCJ2aXNpdG9yX2lkIjoiNjAwODUxNTEzNTU2NjE3NDMzNiIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | c9df97863c8208b40687b0d3ef610c1383637175bcd6be0370650b6ca5810abe |
| hovercard-subject-tag | issue:6038393262 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/triggerdotdev/trigger.dev/5074/issue_layout |
| twitter:image | https://opengraph.githubassets.com/023509bca15946e5766495fc6a6fe960f396749244381866fc19060966a196ab/triggerdotdev/trigger.dev/issues/5074 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/023509bca15946e5766495fc6a6fe960f396749244381866fc19060966a196ab/triggerdotdev/trigger.dev/issues/5074 |
| og:image:alt | Provide environment information OS: Windows (fails); macOS and Linux are not affected trigger.dev CLI and @trigger.dev/build: 4.5.16 The same code is in 4.8.1 and on main Describe the bug additiona... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | SimoMay |
| hostname | github.com |
| expected-hostname | github.com |
| None | 02f4c00e74911c7cd779fc232c3130cee49eb39fd0ed4bfe3eea3b82c7c18084 |
| turbo-cache-control | no-preview |
| go-import | github.com/triggerdotdev/trigger.dev git https://github.com/triggerdotdev/trigger.dev.git |
| octolytics-dimension-user_id | 95297378 |
| octolytics-dimension-user_login | triggerdotdev |
| octolytics-dimension-repository_id | 572570113 |
| octolytics-dimension-repository_nwo | triggerdotdev/trigger.dev |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 572570113 |
| octolytics-dimension-repository_network_root_nwo | triggerdotdev/trigger.dev |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 33c41e9d150e44415272934d676dc63c57d89c3b |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width