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

Links to failed tests need to be URL encoded

    XMLWordPrintable

    Details

    • Similar Issues:

      Description

      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

        Attachments

          Activity

          Hide
          scm_issue_link SCM/JIRA link daemon added a comment -

          Code changed in jenkins
          User: Christoph Kutzinski
          Path:
          src/main/java/hudson/plugins/im/tools/MessageHelper.java
          src/test/java/hudson/plugins/im/tools/MessageHelperTest.java
          http://jenkins-ci.org/commit/instant-messaging-plugin/ad56d7f9a7eb4656013781afddd6dae83dd125ef
          Log:
          [FIXED JENKINS-19944] Links to failed tests need to be URL encoded

          Show
          scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: Christoph Kutzinski Path: src/main/java/hudson/plugins/im/tools/MessageHelper.java src/test/java/hudson/plugins/im/tools/MessageHelperTest.java http://jenkins-ci.org/commit/instant-messaging-plugin/ad56d7f9a7eb4656013781afddd6dae83dd125ef Log: [FIXED JENKINS-19944] Links to failed tests need to be URL encoded
          Hide
          kutzi kutzi added a comment -

          Thanks for the report!
          Fixed in 1.28

          Show
          kutzi kutzi added a comment - Thanks for the report! Fixed in 1.28
          Hide
          mpv Victor Sollerhed added a comment -

          Thanks kutzi, much appreciated!

          Show
          mpv Victor Sollerhed added a comment - Thanks kutzi , much appreciated!

            People

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

              Dates

              • Created:
                Updated:
                Resolved: