From b876deed46ff8aaa63fde58d4fa49a7fceedf15d Mon Sep 17 00:00:00 2001 From: Jelle De Loecker Date: Wed, 14 Feb 2024 17:12:28 +0100 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20Make=20`String.parseQuote(input)?= =?UTF-8?q?`=20not=20fail=20on=20windows=20due=20to=20line=20endings?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/string.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/lib/string.js b/lib/string.js index 08a8496..abc860a 100644 --- a/lib/string.js +++ b/lib/string.js @@ -301,8 +301,12 @@ defStat(function parseQuoted(input) { input = input.replaceAll('"', '\\' + '"'); } - if (quote == '`' && input.includes('\n')) { - input = input.replaceAll('\n', '\\n'); + if (quote == '`') { + if (input.includes('\r\n')) { + input = input.replaceAll('\r\n', '\\n'); + } else if (input.includes('\n')) { + input = input.replaceAll('\n', '\\n'); + } } input = '"' + input + '"';