Skip to content

Commit

Permalink
Ensure that the directory for the temp file and te target file match
Browse files Browse the repository at this point in the history
  • Loading branch information
rscharer committed Jan 17, 2023
1 parent e4b7616 commit 22f5102
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion packages/cdk-assets/lib/private/archive.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ type Logger = (x: string) => void;
export async function zipDirectory(directory: string, outputFile: string, logger: Logger): Promise<void> {
// We write to a temporary file and rename at the last moment. This is so that if we are
// interrupted during this process, we don't leave a half-finished file in the target location.
const temporaryOutputFile = `${randomUUID()}._tmp`;
const outputFileDirectory = path.dirname(outputFile);
const temporaryOutputFile = `${outputFileDirectory}${path.sep}${randomUUID()}._tmp`;
await writeZipFile(directory, temporaryOutputFile);
await moveIntoPlace(temporaryOutputFile, outputFile, logger);
}
Expand Down

0 comments on commit 22f5102

Please sign in to comment.