From d04724c70a1cb762346030a7938c652c7f4a8430 Mon Sep 17 00:00:00 2001 From: Joseph Garrone Date: Fri, 14 Jun 2024 21:53:17 +0200 Subject: [PATCH] fetchProxyOptions compatibility Window OS --- .../downloadAndExtractArchive/fetchProxyOptions.ts | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/bin/tools/downloadAndExtractArchive/fetchProxyOptions.ts b/src/bin/tools/downloadAndExtractArchive/fetchProxyOptions.ts index 3a903d6b..d9a19424 100644 --- a/src/bin/tools/downloadAndExtractArchive/fetchProxyOptions.ts +++ b/src/bin/tools/downloadAndExtractArchive/fetchProxyOptions.ts @@ -79,8 +79,16 @@ export async function getProxyFetchOptions(params: { } const cafileContent = await readFile(cafile, "utf-8"); + + const newLinePlaceholder = "NEW_LINE_PLACEHOLDER_xIsPsK23svt"; + return chunks(cafileContent.split(/(-----END CERTIFICATE-----)/), 2).map( - ca => ca.join("").replace(/^\n/, "").replace(/\n/g, "\\n") + ca => + ca + .join("") + .replace(/\r?\n/g, newLinePlaceholder) + .replace(new RegExp(`^${newLinePlaceholder}`), "") + .replace(new RegExp(newLinePlaceholder, "g"), "\\n") ); })()) );