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

URL created by creating new Item is not encoding '+'s when included in job name

XMLWordPrintable

      Hi,

       

      Issue is that when creating a new job via New Item with '+' in the job name it does not get encoded when generating the url.

      The url returned will have encoded other characters such as spaces, but will not encode '+' symbol.

       

      My use case for this proves to be an issue downstream when retrieving URLs via api calls. I am grabbing job URLs from api/xml, adding query parameters, and then executing more api calls to the specific jobs. Since i am adding more parameters prior to making the next api call I am decoding the url, adding my query parameters, and then encoding the url again.

       

      Since + is usually treated as spaces in encoded urls most libraries that decode a url will turn that + into a space, resulting in an inaccurate url.

       

      To recreate

      Create Job with + in name along side characters such as spaces

      "Job + Name"

      retrieve xml for that name by using following api call

      http://localhost:port/jenkins/api/xml

      Will see that the job url at this point is

      http://localhost:port/jenkins/job/Job%20+%20Name/

      If i was to decode that i will get

      http://localhost:port/jenkins/job/Job   Name/

       

      There is ways to get around my use case such as only encoding the query parameters and appending to the already "half encoded" url, but still think this should be considered a bug as popular convention treats pluses as spaces in the url

       

      Similar issues that have been resolved, still believe that should follow popular convention of encoding + to %2B:

      https://issues.jenkins.io/browse/JENKINS-4344

      https://issues.jenkins.io/browse/JENKINS-728

            Unassigned Unassigned
            dylanfriendly dylan
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated: