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

Missing URL escaping for job names containing "/"

    • Icon: Bug Bug
    • Resolution: Not A Defect
    • Icon: Major Major
    • blueocean-plugin
    • None

      We are using the Bitbucket Branch Source Plugin, which creates job names like 'Project/Repo'. Opening those jobs in Blue Ocean results in a 404 page, because the "/" in the job name is interpreted as being part of the URL. Replacing the "/" with "%2F" results in the pages to load correctly.

          [JENKINS-44190] Missing URL escaping for job names containing "/"

          FWIW, that's actually 1.1.0-beta-4, not 1.0.x

          Heinz Wiesinger added a comment - FWIW, that's actually 1.1.0-beta-4, not 1.0.x

          Vivek Pandey added a comment - - edited

          A bug was fixed sometime back and we started encoding pipeline name, that sounds correct for it to work correctly. This issue is strange.

          pprkut can you provide steps to create such job, specially repo name on Bitbucket that's resulting in blueocean getting the name with '/' in it however classic still gets it correctly.

          Better yet, if you could provide a public Bitbucket repo that we can use to reproduce it will be super helpful.

          Vivek Pandey added a comment - - edited A bug was fixed sometime back and we started encoding pipeline name, that sounds correct for it to work correctly. This issue is strange. pprkut can you provide steps to create such job, specially repo name on Bitbucket that's resulting in blueocean getting the name with '/' in it however classic still gets it correctly. Better yet, if you could provide a public Bitbucket repo that we can use to reproduce it will be super helpful.

          There's nothing special that needs to be done. The job jamesdumay used as an example would already exhibit the same problem. The only difference between his setup and mine with regards to Bitbucket is that he created a job for a single repository specifically, whereas we configure a "Bitbucket Team/Project" type job as root element.

          The "/" is coming from the Bitbucket plugin, not from naming in Bitbucket.

          Heinz Wiesinger added a comment - There's nothing special that needs to be done. The job  jamesdumay  used as an example would already exhibit the same problem. The only difference between his setup and mine with regards to Bitbucket is that he created a job for a single repository specifically, whereas we configure a "Bitbucket Team/Project" type job as root element. The "/" is coming from the Bitbucket plugin, not from naming in Bitbucket.

          James Dumay added a comment -

          pprkut ahh! I didn't think of that type - sorry if I missed it. Yes, there is something odd going on there. I suspect it isn't properly encoded within the bitbucket plugin

          James Dumay added a comment - pprkut ahh! I didn't think of that type - sorry if I missed it. Yes, there is something odd going on there. I suspect it isn't properly encoded within the bitbucket plugin

          To be honest, I'm not sure that's it. If that were the case, it wouldn't work for you when you switch between classic and blue ocean either. In that URL it's encoded properly. It's the value of the URL returned in the Location header in case of redirects that's still wrong, at least here.

          Heinz Wiesinger added a comment - To be honest, I'm not sure that's it. If that were the case, it wouldn't work for you when you switch between classic and blue ocean either. In that URL it's encoded properly. It's the value of the URL returned in the Location header in case of redirects that's still wrong, at least here.

          James Dumay added a comment -

          pprkut I'm using a "Multibranch Project" with a Bitbucket SCM source - I believe they are different?

          James Dumay added a comment - pprkut I'm using a "Multibranch Project" with a Bitbucket SCM source - I believe they are different?

          jamesdumay No it's the same. The only difference is in the hierarchy level with regards to navigation in Jenkins / Blue Ocean. Take your "AS/app-store-demo" repo as an example.
          With a simple Multibranch Project Job navigation is this:

          Jenkins -> AS/app-store-demo

          With a Bitbucket Team/Project Job navigation would be

          Jenkins -> AS -> AS/app-store-demo

          It doesn't change the fact that there is a "/" in the job name

          Heinz Wiesinger added a comment - jamesdumay No it's the same. The only difference is in the hierarchy level with regards to navigation in Jenkins / Blue Ocean. Take your "AS/app-store-demo" repo as an example. With a simple Multibranch Project Job navigation is this: Jenkins -> AS/app-store-demo With a Bitbucket Team/Project Job navigation would be Jenkins -> AS -> AS/app-store-demo It doesn't change the fact that there is a "/" in the job name

          James Dumay added a comment -

          pprkut I downgraded to Blue Ocean 1.0.1 this morning and created a "Bitbucket Team/Project" item. Here is a screencast of my reproduction steps. I was unable to see the encoding issue with these new steps. Is there something I am missing here?

          Hmm, you wouldn't happen to have a HTTP reverse proxy in front of Blue Ocean would you?

          James Dumay added a comment - pprkut I downgraded to Blue Ocean 1.0.1 this morning and created a "Bitbucket Team/Project" item. Here is a screencast of my reproduction steps. I was unable to see the encoding issue with these new steps. Is there something I am missing here? Hmm, you wouldn't happen to have a HTTP reverse proxy in front of Blue Ocean would you?

          You're right. I do have nginx in front of jenkins. Just tried without it and it does work when nginx is not involved. The redirection (because of the missing "/" at the end of the URL) is still there though, just in this scenario the returned Location header doesn't contain a decoded URL. So if we could still add that slash it would still help.

          In the meantime, I'll try to figure out why nginx decodes the returned location URL :-/

          Heinz Wiesinger added a comment - You're right. I do have nginx in front of jenkins. Just tried without it and it does work when nginx is not involved. The redirection (because of the missing "/" at the end of the URL) is still there though, just in this scenario the returned Location header doesn't contain a decoded URL. So if we could still add that slash it would still help. In the meantime, I'll try to figure out why nginx decodes the returned location URL :-/

          James Dumay added a comment -

          pprkut if you follow this guide carefully it should show you how to get the encoding to work properly so that the slash gets passed through. I believe there is something in the way that Jenkins double encodes spaces and slashes that sometimes gets stripped out by the proxy.

          James Dumay added a comment - pprkut if you follow this guide carefully it should show you how to get the encoding to work properly so that the slash gets passed through. I believe there is something in the way that Jenkins double encodes spaces and slashes that sometimes gets stripped out by the proxy.

            jamesdumay James Dumay
            pprkut Heinz Wiesinger
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: