Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion src/copy-worker.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,17 @@ const { files, sourceBase, destBase } = workerData;
let copied = 0;
let skipped = 0;
const errors = [];
const resolvedDestBase = path.resolve(destBase);

for (const relativePath of files) {
const srcPath = path.join(sourceBase, relativePath);
const destPath = path.join(destBase, relativePath);
const destPath = path.resolve(destBase, relativePath);

if (destPath !== resolvedDestBase && !destPath.startsWith(resolvedDestBase + path.sep)) {
skipped++;
errors.push({ file: relativePath, error: 'Invalid destination path' });
continue;
}

try {
// Ensure parent directory exists
Expand Down