瀏覽代碼

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);