فهرست منبع

HUE-9193 [oozie] Allow workflow argument mixed with single and double quotes

Ying Chen 5 سال پیش
والد
کامیت
0dc207094b
1فایلهای تغییر یافته به همراه3 افزوده شده و 1 حذف شده
  1. 3 1
      desktop/core/src/desktop/js/ko/bindings/ko.parseArguments.js

+ 3 - 1
desktop/core/src/desktop/js/ko/bindings/ko.parseArguments.js

@@ -25,13 +25,15 @@ ko.bindingHandlers.parseArguments = {
       const bits = [];
       let isInQuotes = false;
       let tempStr = '';
+      let charQuote = null;
       str
         .replace(/<\/?arg>|<\/?command>/gi, ' ')
         .replace(/\r?\n|\r/g, '')
         .replace(/\s\s+/g, ' ')
         .split('')
         .forEach(char => {
-          if (char === '"' || char === "'") {
+          if ((char === '"' || char === "'") && (!charQuote || charQuote == char)) {
+            charQuote = isInQuotes ? null : char;
             isInQuotes = !isInQuotes;
           } else if ((char === ' ' || char === '\n') && !isInQuotes && tempStr !== '') {
             bits.push(tempStr);