File tree Expand file tree Collapse file tree 1 file changed +7
-4
lines changed
Expand file tree Collapse file tree 1 file changed +7
-4
lines changed Original file line number Diff line number Diff line change @@ -414,8 +414,8 @@ export class CxWrapper {
414414 return params ;
415415 }
416416
417- // Initial split (handles quoted strings)
418- const paramList = additionalParameters . match ( / (?: [ ^ \s " ] + | " [ ^ " ] * " ) + / g) ;
417+ // Improved regex to handle complex nested quotes
418+ const paramList = additionalParameters . match ( / (?: [ ^ \s " ' ] + | " (?: [ ^ " \\ ] | \\ . ) * " | ' (?: [ ^ ' \\ ] | \\ . ) * ' ) + / g) ;
419419 logger . info ( "Additional parameters refined: " + paramList ) ;
420420
421421 if ( paramList ) {
@@ -429,15 +429,18 @@ export class CxWrapper {
429429
430430 // Handle --sca-resolver-params or similar flags
431431 if ( element === "--sca-resolver-params" && i + 1 < paramList . length ) {
432+ // Add the flag itself
433+ params . push ( element ) ;
434+
432435 const rawValue = paramList [ i + 1 ] ;
433436
434437 // Remove outer quotes if present
435438 const unquoted = rawValue . startsWith ( '"' ) && rawValue . endsWith ( '"' )
436439 ? rawValue . slice ( 1 , - 1 )
437440 : rawValue ;
438441
439- // Split inner string using shell-like logic (e.g., keeping inner quotes)
440- const nestedParams = unquoted . match ( / (?: [ ^ \s " ' ] + | ' [ ^ ' ] * ' | " [ ^ " ] * " ) + / g) ;
442+ // Split inner string using shell-like logic (handling both single and double quotes)
443+ const nestedParams = unquoted . match ( / (?: [ ^ \s " ' ] + | " (?: [ ^ " \\ ] | \\ . ) * " | ' (?: [ ^ ' \\ ] | \\ . ) * ' ) + / g) ;
441444
442445 if ( nestedParams ) {
443446 nestedParams . forEach ( p => params . push ( p ) ) ;
You can’t perform that action at this time.
0 commit comments