Skip to content

Commit 4d68eef

Browse files
committed
fix: Fix bug with empty quick edit directories
1 parent 8b12768 commit 4d68eef

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

packages/core/src/lambda/commands/editLambda.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,8 +159,14 @@ export async function editLambda(lambda: LambdaFunction, onActivation?: boolean)
159159
// This record tells us if they're attempting to edit a function they've edited before
160160
telemetry.record({ action: localExists ? 'existingEdit' : 'newEdit' })
161161

162+
const isDirectoryEmpty = (await fs.existsDir(downloadLocation))
163+
? (await fs.readdir(downloadLocation)).length === 0
164+
: true
165+
162166
const overwriteChanges =
163-
!localExists || (!(await compareCodeSha(lambda)) ? await confirmOutdatedChanges(prompt) : false)
167+
!localExists ||
168+
isDirectoryEmpty ||
169+
(!(await compareCodeSha(lambda)) ? await confirmOutdatedChanges(prompt) : false)
164170

165171
if (overwriteChanges) {
166172
try {

0 commit comments

Comments
 (0)