Uploaded image for project: 'SR for Jira - Development'
  1. SR for Jira - Development
  2. SRJIRA-6086

Fragments Custom Web Item link velocity variables no longer working

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Done
    • Low
    • Resolution: Done
    • 6.57.0
    • 6.58.0
    • Fragments
    • None
    • SR4J Sprint 129 (6.58), SR4J Sprint 130 (7.00)
    • 25.5

    Description

      Summary

      The relative URL that a Custom Web Item redirects to seems to get resolved differently in the latest version of ScriptRunner 6.57.0. The same Custom Web Item fragment setup works fine in version 6.56.0.

      Steps to Reproduce the Problem

      1. Navigate to Fragments > click on Create Fragment > select Custom web item
      2. Fill in the details as below:

        What section should this go in: transitions-all
        Key: web-item-test
        Menu text: Web Item Test
        Do what: Navigate to a link
        Link: http://<Jira Base URL>/browse/${issue.key}

      3. Open an issue > click on the Workflow button > click on Web Item Test
      4. Note the error on the screen "Cannot open project/issue" (see screenshot 6.57.0 invalid URL.png)
      5. Note the error in the logs:
        2022-08-15 06:36:08,293+0000 http-nio-8080-exec-3 WARN admin 396x360x1 zkgwjb 172.17.0.1 /plugins/servlet/scriptrunner/webitemredirect [c.a.w.s.plugin.request.RedirectInterceptingResponse] Invalid location: http://localhost:8084/browse/${issue.key}
        java.net.URISyntaxException: Illegal character in path at index 30: http://localhost:8084/browse/${issue.key}
        	at java.base/java.net.URI$Parser.fail(URI.java:2913)
        	at java.base/java.net.URI$Parser.checkChars(URI.java:3084)
        	at java.base/java.net.URI$Parser.parseHierarchical(URI.java:3166)
        	at java.base/java.net.URI$Parser.parse(URI.java:3114)
        	at java.base/java.net.URI.<init>(URI.java:600)
        	at com.atlassian.web.servlet.plugin.request.RedirectInterceptingResponse.locationWithinCurrentContext(RedirectInterceptingResponse.java:63)
        	at com.atlassian.web.servlet.plugin.request.RedirectInterceptingResponse.forward(RedirectInterceptingResponse.java:48)
        	at com.atlassian.web.servlet.plugin.request.RedirectInterceptingResponse.sendRedirect(RedirectInterceptingResponse.java:36)
        	at javax.servlet.http.HttpServletResponseWrapper.sendRedirect(HttpServletResponseWrapper.java:138)
        	... 1 filtered
        	at javax.servlet.http.HttpServletResponse$sendRedirect.call(Unknown Source)
        	at com.onresolve.scriptrunner.runner.servlets.WebItemLinkServlet.doGet(WebItemLinkServlet.groovy:45)
        	at javax.servlet.http.HttpServlet.service(HttpServlet.java:655)
        	at javax.servlet.http.HttpServlet.service(HttpServlet.java:764)
        	at com.atlassian.plugin.servlet.DelegatingPluginServlet.service(DelegatingPluginServlet.java:37)
        	at javax.servlet.http.HttpServlet.service(HttpServlet.java:764)
        	at com.atlassian.plugin.servlet.ServletModuleContainerServlet.service(ServletModuleContainerServlet.java:47)
        	at javax.servlet.http.HttpServlet.service(HttpServlet.java:764)
        	... 44 filtered
        	at com.atlassian.servicedesk.internal.web.ExternalCustomerLockoutFilter.doFilter(ExternalCustomerLockoutFilter.java:55)
        	... 8 filtered
        	at com.atlassian.jira.plugin.mobile.web.filter.MobileAppRequestFilter.doFilter(MobileAppRequestFilter.java:59)
        	... 4 filtered
        	at com.atlassian.jira.plugin.mobile.login.MobileLoginSuccessFilter.doFilter(MobileLoginSuccessFilter.java:54)
        	... 3 filtered
        	at com.atlassian.diagnostics.internal.platform.monitor.http.HttpRequestMonitoringFilter.doFilter(HttpRequestMonitoringFilter.java:55)
        	... 8 filtered
        	at com.atlassian.web.servlet.plugin.request.RedirectInterceptingFilter.doFilter(RedirectInterceptingFilter.java:21)
        	... 48 filtered
        	at com.atlassian.troubleshooting.thready.filter.AbstractThreadNamingFilter.doFilter(AbstractThreadNamingFilter.java:46)
        	... 17 filtered
        	at com.atlassian.jira.security.JiraSecurityFilter.lambda$doFilter$0(JiraSecurityFilter.java:66)
        	... 1 filtered
        	at com.atlassian.jira.security.JiraSecurityFilter.doFilter(JiraSecurityFilter.java:64)
        	... 16 filtered
        	at com.atlassian.pats.web.filter.TokenBasedAuthenticationFilter.doFilter(TokenBasedAuthenticationFilter.java:82)
        	... 23 filtered
        	at com.atlassian.jira.servermetrics.CorrelationIdPopulatorFilter.doFilter(CorrelationIdPopulatorFilter.java:30)
        	... 5 filtered
        	at com.atlassian.plugins.authentication.basicauth.filter.DisableBasicAuthFilter.doFilter(DisableBasicAuthFilter.java:70)
        	... 3 filtered
        	at com.atlassian.servicedesk.internal.web.CustomerContextSettingFilter.lambda$invokeFilterChain$0(CustomerContextSettingFilter.java:215)
        	at com.atlassian.servicedesk.internal.api.util.context.ReentrantThreadLocalBasedCodeContext.rteInvoke(ReentrantThreadLocalBasedCodeContext.java:136)
        	at com.atlassian.servicedesk.internal.api.util.context.ReentrantThreadLocalBasedCodeContext.runOutOfContext(ReentrantThreadLocalBasedCodeContext.java:89)
        	at com.atlassian.servicedesk.internal.utils.context.CustomerContextServiceImpl.runOutOfCustomerContext(CustomerContextServiceImpl.java:47)
        	at com.atlassian.servicedesk.internal.web.CustomerContextSettingFilter.outOfCustomerContext(CustomerContextSettingFilter.java:206)
        	at com.atlassian.servicedesk.internal.web.CustomerContextSettingFilter.doFilterImpl(CustomerContextSettingFilter.java:134)
        	at com.atlassian.servicedesk.internal.web.CustomerContextSettingFilter.doFilter(CustomerContextSettingFilter.java:123)
        	... 4 filtered
        	at com.atlassian.jwt.internal.servlet.JwtAuthFilter.doFilter(JwtAuthFilter.java:37)
        	... 8 filtered
        	at com.atlassian.web.servlet.plugin.request.RedirectInterceptingFilter.doFilter(RedirectInterceptingFilter.java:21)
        	... 4 filtered
        	at com.atlassian.troubleshooting.thready.filter.AbstractThreadNamingFilter.doFilter(AbstractThreadNamingFilter.java:46)
        	... 3 filtered
        	at com.atlassian.web.servlet.plugin.LocationCleanerFilter.doFilter(LocationCleanerFilter.java:36)
        	... 29 filtered
        	at com.atlassian.jira.servermetrics.MetricsCollectorFilter.doFilter(MetricsCollectorFilter.java:25)
        	... 25 filtered
        	at org.apache.tomcat.util.threads.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1191)
        	at org.apache.tomcat.util.threads.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:659)
        	at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
        	at java.base/java.lang.Thread.run(Thread.java:829)
        

      Expected Behaviour

      The variable specified in the relative URL should get interpolated and the URL gets resolved correctly.

      Actual Behaviour

      The variable specified in the relative URL does not seem to be correctly interpolated. The hyperlink that the custom web item points to looks different.

      Additional Info

      Reproducible in

      Not reproducible in

      • Jira Software 8.20.6 | ScriptRunner 6.45.0
      • Jira Software 8.20.11 | ScriptRunner 6.56.0
      • In ScriptRunner version 6.56.0, the hyperlink looks like this:
        http://localhost:8085/browse/PX-1?

      Workaround:

      You can replace the web item with a Raw XML Module temporarily to get around this bug

      1. Click to edit the web item
      2. Copy the Link field contents to a text file
      3. Click preview on the web item edit page
      4. Copy the XML content that you then see to a text file
      5. For the XML you copied above, replace the link between the XML link tag with the link you copied from the web item edit page
      6. Now create a Raw XML Module and paste in the new XML we defined above, save it and then disable the original web item for now

       

      Attachments

        Issue Links

          Activity

            People

              mclark Matthew Clark
              wkoh Winnie Koh
              Votes:
              1 Vote for this issue
              Watchers:
              21 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: