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

HAL self href to queue item returned from "start build" API is not properly encoded

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Blocker Blocker
    • blueocean-plugin
    • None
    • 1.0-beta-1

      The HAL href to a multi-branch queue item is not properly encoding the branch name portion of the URL. Given the following request:

      URL: http://localhost:8080/jenkins/blue/rest/organizations/jenkins/pipelines/jdl1/branches/experiment%252Fbuild-locally-docker/runs/
      
      Method: PUT
      
      Headers:
      
      Accept:*/*
      Accept-Encoding:gzip, deflate, sdch
      Accept-Language:en-US,en;q=0.8
      authorization:Bearer *snipped*
      Cache-Control:no-cache
      Connection:keep-alive
      Content-Length:0
      content-type:application/json
      Host:localhost:8080
      Origin:http://localhost:8080
      Pragma:no-cache
      Referer:http://localhost:8080/jenkins/blue/organizations/jenkins/jdl1/branches
      User-Agent:Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/52.0.2743.116 Safari/537.36
      

      This is the response:

      {
          "_class": "io.jenkins.blueocean.service.embedded.rest.QueueItemImpl",
          "_links": {
              "self": {
                  "_class": "io.jenkins.blueocean.rest.hal.Link",
                  "href": "/blue/rest/organizations/jenkins/pipelines/jdl1/pipelines/experiment%2Fbuild-locally-docker/queue/44/"
              }
          },
          "expectedBuildNumber": 48,
          "id": "44",
          "organization": "jenkins",
          "pipeline": "experiment%2Fbuild-locally-docker",
          "queuedTime": "2016-08-31T17:30:30.051-0400"
      }
      

      This URL is lacking the double-encoded branch name:
      /blue/rest/organizations/jenkins/pipelines/jdl1/pipelines/experiment%2Fbuild-locally-docker/queue/44/

      A request to that URL returns a stapler error

      ./jwtcurl.sh -u cmeyers:cmeyers http://localhost:8080/jenkins/blue/rest/organizations/jenkins/pipelines/jdl1/pipelines/experiment%2Fbuild-locally-docker/queue/
      <html><body>
      <h1>404 Not Found</h1>
      

      A request to the double encoded URL returns an empty array (expected, since the run began executing immediately)

      ./jwtcurl.sh -u cmeyers:cmeyers http://localhost:8080/jenkins/blue/rest/organizations/jenkins/pipelines/jdl1/pipelines/experiment%252Fbuild-locally-docker/queue/
      []
      

            vivek Vivek Pandey
            cliffmeyers Cliff Meyers
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: