Skip to content

Commit ce8992d

Browse files
author
David Hasani
committed
skip symlinks
1 parent 78a64ec commit ce8992d

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

packages/core/src/codewhisperer/commands/startTransformByQ.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -688,9 +688,8 @@ export async function postTransformationJob() {
688688
})
689689
}
690690

691-
if (transformByQState.getPayloadFilePath() !== '') {
692-
// TO-DO: uncomment this out for public toolkit, but keep it commented out for AIG custom build
693-
// fs.rmSync(transformByQState.getPayloadFilePath(), { recursive: true, force: true }) // delete ZIP if it exists
691+
if (fs.existsSync(transformByQState.getPayloadFilePath())) {
692+
fs.rmSync(transformByQState.getPayloadFilePath(), { recursive: true, force: true }) // delete ZIP if it exists
694693
}
695694
}
696695

packages/core/src/codewhisperer/service/transformByQ/transformApiHandler.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -347,7 +347,12 @@ export async function zipCode({ dependenciesFolder, humanInTheLoopFlag, modulePa
347347
const sourceFiles = getFilesRecursively(modulePath, false)
348348
let sourceFilesSize = 0
349349
for (const file of sourceFiles) {
350+
if ((await fs.stat(file)).isDirectory()) {
351+
getLogger().info(`CodeTransformation: Skipping directory, likely a symlink`)
352+
continue
353+
}
350354
if (isExcludedFile(file)) {
355+
getLogger().info(`CodeTransformation: Skipping excluded file`)
351356
continue
352357
}
353358
const relativePath = path.relative(modulePath, file)
@@ -424,7 +429,7 @@ export async function zipCode({ dependenciesFolder, humanInTheLoopFlag, modulePa
424429
result: MetadataResult.Fail,
425430
reason: 'ZipCreationFailed',
426431
})
427-
throw Error('Failed to zip project')
432+
throw Error('Failed to zip project due to: ' + (e as Error).message)
428433
} finally {
429434
if (logFilePath) {
430435
fs.rmSync(logFilePath)

0 commit comments

Comments
 (0)