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

Strings are not properly escaped when converting to JSON during various operations

      The various blocks of code that build up JSON in RESTClient.java do not escape the strings added to the overall JSON string. This was discovered by adding a JQL query that had double quotes in it. The REST API returned a 400:

      Failed with 400: project=TEST AND text~"Customer Reported Bug"

      Worked: project=TEST AND text~\"Customer Reported Bug\"

      It looks like this is an issue with all JSON string building.

          [JENKINS-32173] Strings are not properly escaped when converting to JSON during various operations

          John Speak added a comment -

          I just spent a few hours trying to google around trying to resolve this issue, thank you for raising this issue J D - your work around works great. Hopefully it will get fixed at some point or the documentation updated to reference the need to escape the quotes around values so others get this solved.

          John Speak added a comment - I just spent a few hours trying to google around trying to resolve this issue, thank you for raising this issue J D - your work around works great. Hopefully it will get fixed at some point or the documentation updated to reference the need to escape the quotes around values so others get this solved.

          J D added a comment -

          Your welcome John! I'm glad it helped you out. I'm hoping this gets fixed too!

          J D added a comment - Your welcome John! I'm glad it helped you out. I'm hoping this gets fixed too!

            Unassigned Unassigned
            dstruct J D
            Votes:
            1 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated: