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

Links to failed tests need to be URL encoded

XMLWordPrintable

      Steps to reproduce:
      1. Have a jenkins job with IM plugin enabled to send notifications (with Jabber in our case)
      2. Set up a test that fails which contains a space in the name
      3. Run test and Jenkins IM plugin will send the notification

      Expected result:
      3. Correct link to the failed test

      Actual result:
      3. Link to the test is incorrect, since it contains non url-encoded characters.

      In the example in the screenshot you can see that the Jabber client automatically creates a link to the test, but fails at the first space (after "Price" in "Price type rules").

      Possible solution:
      I have identified where in the code the URL is built:

      • MessageHelper.getTestUrl() for building the url to the failing test
      • MessageHelper.getBuildURL() for building the base link (and the link to the build)

      https://github.com/jenkinsci/instant-messaging-plugin/blob/master/src/main/java/hudson/plugins/im/tools/MessageHelper.java?source=cc

      It seems that there is some encoding done in getBuildURL() but not in getTestUrl()?

      And here's where it is used to build the full string sent:
      https://github.com/jenkinsci/instant-messaging-plugin/blob/29e24e0f1e5714749a479b6e5c4224c3ac66b701/src/main/java/hudson/plugins/im/build_notify/PrintFailingTestsBuildToChatNotifier.java#L87-L95

            kutzi kutzi
            mpv Victor Sollerhed
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: