Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-10201

Stapler automatically wraps braces in quotes, but does not reverse the quotes on Java side

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: Major Major
    • core
    • None

      A f:textbox input where the user enters a string that both starts and ends with curly braces (e.g., "

      {foo}

      ") has its value wrapped in double quotes by the stapler JSON encoder (presumably to distinguish the "

      {..}

      " string from a JSON object). However, the double-quotes do not get stripped on the other side. Example:

          @DataBoundConstructor
          public SomeClass(final String input) {
              LOGGER.log(Level.FINEST, "Received input: " + input);
              this.input = input;
          }
      

      results in the following test results (" – input" represents the literal that was entered into the field):

        -- input = X\{foo\}X
      FINEST: Received input: X\{foo\}X
      
        -- input = \{foo\}X
      FINEST: Received input: \{foo\}X
      
        -- input = X\{foo\}
      FINEST: Received input: X\{foo\}
      
        -- input = \{foo\}
      FINEST: Received input: "\{foo\}"
      
        -- input = \{foo\}\{bar\}
      FINEST: Received input: "\{foo\}\{bar\}"

      The last 2 entries do not have the double quotes stripped from the input. Once the string is received by Stapler, it should be able to decode the string to recover what the user initially entered in the field.

            Unassigned Unassigned
            jhansche Joe Hansche
            Votes:
            2 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: