diff --git a/__tests__/utils.test.ts b/__tests__/utils.test.ts index 43337465..3eab1960 100644 --- a/__tests__/utils.test.ts +++ b/__tests__/utils.test.ts @@ -97,12 +97,9 @@ describe('Utils tests', () => { const runner_dir: string = process.env['RUNNER_TOOL_CACHE'] || ''; const script_path: string = path.join(runner_dir, 'test.sh'); await utils.writeScript('test.sh', testString); - await fs.readFile( - script_path, - function (error: Error | null, data: Buffer) { - expect(testString).toBe(data.toString()); - } - ); + fs.readFile(script_path, function (error: Error | null, data: Buffer) { + expect(testString).toBe(data.toString()); + }); await cleanup(script_path); }); @@ -135,6 +132,17 @@ describe('Utils tests', () => { 'b=3, 4', 'c=5' ]); + expect(await utils.CSVArray('\'a=1,2\', "b=3, 4", c=5, d=~e~')).toEqual([ + 'a=1,2', + 'b=3, 4', + 'c=5', + "d='~e~'" + ]); + expect(await utils.CSVArray('a=\'1,2\', b="3, 4", c=5')).toEqual([ + 'a=1,2', + 'b=3, 4', + 'c=5' + ]); expect(await utils.CSVArray('')).toEqual([]); expect(await utils.CSVArray(' ')).toEqual([]); }); diff --git a/dist/index.js b/dist/index.js index e1272644..142be1b8 100644 --- a/dist/index.js +++ b/dist/index.js @@ -1285,7 +1285,7 @@ async function CSVArray(values_csv) { return value .trim() .replace(/^["']|["']$|(?<==)["']/g, '') - .replace(/=(.*[?{}|&~![()^]+.*)/, "='$1'"); + .replace(/=(((?!E_).)*[?{}|&~![()^]+((?!E_).)+)/, "='$1'"); }) .filter(Boolean); } diff --git a/src/utils.ts b/src/utils.ts index c88f339b..8f74ccf8 100644 --- a/src/utils.ts +++ b/src/utils.ts @@ -274,7 +274,7 @@ export async function CSVArray(values_csv: string): Promise> { return value .trim() .replace(/^["']|["']$|(?<==)["']/g, '') - .replace(/=(.*[?{}|&~![()^]+.*)/, "='$1'"); + .replace(/=(((?!E_).)*[?{}|&~![()^]+((?!E_).)+)/, "='$1'"); }) .filter(Boolean); }