Uploaded image for project: 'Automation for Cloud'
  1. Automation for Cloud
  2. AUTO-1107

Use the Java URI Class instead of the Java URLEncode Class with the urlEncode Jira smart value function

XMLWordPrintable

    • Our product teams collect and evaluate feedback from a number of different sources. To learn more about how we use customer feedback in the planning process, check out our new feature policy.

      Summary

      Currently the urlEncode Jira smart value function uses the Java URLEncode class (java.net.URLEncoder) for encoding.

      Per the class documentation when handling blank spaces, it encodes these as a + character:

      The space character " " is converted into a plus sign "+".

      On the other hand, the Java URI class (java.net.URI) encodes blank spaces as %20:

      An illegal character is quoted simply by encoding it. The space character, for example, is quoted by replacing it with "%20". UTF-8 contains US-ASCII, hence for US-ASCII characters this transformation has exactly the effect required by RFC 2396.

      When using smart values that are URL encoded in this manner as part of a URI path, depending on the position of the encoded value, it can break the URL as the + character will be taken as exactly that as opposed to treated as a blank value.

      Workaround

      The + character can be replaced as part of the smart value using the replace() or replaceAll() functions. Further details on the workaround can be found on the article:

              Unassigned Unassigned
              f189ef36d400 Andras M.
              Votes:
              1 Vote for this issue
              Watchers:
              4 Start watching this issue

                Created:
                Updated: