bug: additionalFiles copies ../ matches outside the build on Windows
Maintainer thường phản hồi trong vòng 1 ngày
Chưa có ai nhận issue này.
- #5075 của @SimoMay — đã đóng, không merge
Đánh giá
- Độ khó
- 2/5
- Thời gian dự kiến
- 1-3 giờ
- Mức phù hợp với người mới
- 35/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Đặc tả rõ ràng
- Mức độ hoạt động
- Đình trệ
- Công nghệ
- node.js, typescript
- Lĩnh vực
- build-system
Hướng nghiên cứu
Start with packages/build/src/internal/copyFiles.ts and inspect findFilesByMatchers, focusing on how relative() paths are split and joined. Use the included path.win32 reproduction to confirm the Windows behavior, then verify the destination resolves to <build>/shared/a.md on both Windows and POSIX paths. A linked pull request, #5075, already addresses this issue.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Provide environment information
- OS: Windows (fails); macOS and Linux are not affected
trigger.devCLI 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 .. 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.
The cause is findFilesByMatchers in packages/build/src/internal/copyFiles.ts:
const pathInsideDestinationDir = relative(cwd, file)
.split(posix.sep)
.filter((p) => p !== "..")
.join(posix.sep);
On 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 ...
Expected: the files land at <build>/shared/a.md on every OS, as they do on macOS and Linux.
Reproduction repo
No repo needed. The Node script below runs the same path logic with path.win32, on any OS.
To reproduce
const { win32, posix } = require("node:path");
const cwd = "C:\\repo\\app";
const file = "C:\\repo\\shared\\a.md";
const dest = "C:\\repo\\app\\.trigger\\tmp\\build-x";
const inside = win32.relative(cwd, file).split(posix.sep).filter((p) => p !== "..").join(posix.sep);
console.log(win32.join(dest, inside));
// C:\repo\app\.trigger\tmp\shared\a.md <- outside build-x
End to end, on Windows:
- In a project one level below the repo root, add
additionalFiles({ files: ["../shared/**"] })totrigger.config.ts. - Run
npx trigger.dev deploy. - The deployed image has no
shared/folder. The same deploy from macOS includes it.
A task that reads one of those files at runtime then fails with a missing file.
Suggested fix
Split on the platform separator, and keep joining with / (join accepts it on Windows):
const pathInsideDestinationDir = relative(cwd, file)
.split(sep)
.filter((p) => p !== "..")
.join(posix.sep);
With path.win32 and path.posix, both resolve to <build>/shared/a.md. A PR with this change follows.
- Ngôn ngữ chính
- TypeScript
- Star
- 16.5k
- Fork
- 1.5k
- Merge trung bình
- 1 ngày 15 giờ
- Pull request đã merge (30 ngày)
- 17
Chuẩn bị môi trường
Dự án này không cung cấp dev container, Dockerfile hay hướng dẫn đóng góp, nên bạn cần tự thiết lập môi trường: hãy bắt đầu từ README và xem hướng dẫn đóng góp lần đầu của chúng tôi để biết các bước chung.
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của triggerdotdev/trigger.dev
-
bug: retry.fetch ignores the caller's abort signal and retries aborted requestsCó thể làm lại được Pull request cho issue này đã bị đóng mà không được merge. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
triggerdotdev/trigger.dev#5116 · 2 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
bug: Chat transport crashes on Safari < 17.4: AbortSignal.any is not a functionCó thể làm lại được Pull request cho issue này đã bị đóng mà không được merge. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 83/100
triggerdotdev/trigger.dev#5098 · 2 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
bug: Side menu items lose their active state on detail pagesCó thể làm lại được Pull request cho issue này đã bị đóng mà không được merge. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
triggerdotdev/trigger.dev#5088 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
bug: RBAC loader logs "plugin found but failed to load" when @triggerdotdev/plugins is simply not installedCó thể làm lại được @itsfaryal đã nhận 17 ngày trước và không có pull request nào đang mở. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
triggerdotdev/trigger.dev#5083 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 83/100
triggerdotdev/trigger.dev#5072 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của triggerdotdev/trigger.dev
Issue tương tự
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
Maintainer thường phản hồi trong vòng 1 ngày
-
bug platform-android
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
Termix-SSH/Mobile#146 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 2 ngày
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 66/100
devswha/herdr-web-ui#3875 ·
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 88/100
-
area: runtime chore cli consistency dependencies developer-experience difficulty: easy discovery documentation enhancement good first issue help wanted hygiene json-output packaging priority: P3 tests version
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
Maintainer thường phản hồi trong vòng 1 ngày