From 5124cbd0980dcd9deb64a1f43193edea9b86cb71 Mon Sep 17 00:00:00 2001 From: Christof Marti Date: Mon, 24 Jul 2023 11:35:09 +0200 Subject: [PATCH] Preserve binary files (#599) --- src/spec-configuration/containerTemplatesOCI.ts | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/spec-configuration/containerTemplatesOCI.ts b/src/spec-configuration/containerTemplatesOCI.ts index acd40a70..1c57b244 100644 --- a/src/spec-configuration/containerTemplatesOCI.ts +++ b/src/spec-configuration/containerTemplatesOCI.ts @@ -89,8 +89,11 @@ export async function fetchTemplate(params: CommonParams, selectedTemplate: Sele const filePath = path.join(templateDestPath, f); if (await isLocalFile(filePath)) { const fileContents = await readLocalFile(filePath); - const fileContentsReplaced = replaceTemplatedValues(output, fileContents.toString(), userSelectedOptions); - await writeLocalFile(filePath, Buffer.from(fileContentsReplaced)); + const originalContent = fileContents.toString(); + const fileContentsReplaced = replaceTemplatedValues(output, originalContent, userSelectedOptions); + if (fileContentsReplaced !== originalContent) { + await writeLocalFile(filePath, Buffer.from(fileContentsReplaced)); + } } else { output.write(`Could not find templated file '${f}'.`, LogLevel.Error); }