Uploaded image for project: 'Confluence Data Center'
  1. Confluence Data Center
  2. CONFSERVER-29566

display applink "RpcUrl" in JiraIssuesMacro

    XMLWordPrintable

Details

    Description

      identifying of the applink, only checks for rpcurl!

      class com.atlassian.confluence.extra.jira.JiraIssuesMacro

      public String execute(Map parameters, String body, ConversionContext conversionContext) throws MacroExecutionException {
      ...
      
        else // if requestType == Type.URL {
          Iterable<ApplicationLink> applicationLinks = appLinkService.getApplicationLinks(JiraApplicationType.class);
          for (ApplicationLink applicationLink : applicationLinks) {
            // Dieter: where is the check for display url ?
            if (requestData.indexOf(applicationLink.getRpcUrl().toString()) == 0) {
              applink = applicationLink;
              break;
            }
          }
        }
      
      }
      

      Steps to Reproduce

      1. Setup an application link with JIRA from Confluence Admin >> Application Links
      2. Set the Display URL to http://localhost:8511/jira (domain = localhost)
      3. Set the Application URL to http://127.0.0.1:8511/jira (no domain, IP address only)
      4. Navigate to JIRA via http://localhost:8511/jira , and obtain an xml representation of the Issue Navigator, example: http://localhost:8511/jira/sr/jira.issueviews:searchrequest-xml/temp/SearchRequest.xml?jqlQuery=project+%3D+TEST&tempMax=1000
      5. Copy the URL of that XML view, and add a JIRA Issues macro to a Confluence page (Insert >> Other Macros >> JIRA Issues). Enter the url as the XML URL above, and hit Refresh. You will get a warning similar to below:

        Inserting the macro this way will render the contents in static HTML. Changing the URL to this instead, solves the issue: http://127.0.0.1:8511/jira/sr/jira.issueviews:searchrequest-xml/temp/SearchRequest.xml?jqlQuery=project+%3D+TEST&tempMax=1000 (change to application URL)

      This applies to other situations as well, such as a proxy environment:
      Application URL: http://10.90.2.2:8080/jira
      Display URL: http://www.example.com/jira

      Recommended Fix

      class com.atlassian.confluence.extra.jira.JiraIssuesMacro

      public String execute(Map parameters, String body, ConversionContext conversionContext) throws MacroExecutionException {
      ...
      
      
        if requestType == Type.URL {
          Iterable<ApplicationLink> applicationLinks = appLinkService.getApplicationLinks(JiraApplicationType.class);
          for (ApplicationLink applicationLink : applicationLinks) {
            /* requestData contains http://vldevhp04.at.inside:8888/jira (display url of application link)
             * so the condition will never be ==0
             * because rpcUrl is http://127.0.0.1:8101/jira (rpc url of application link)
             *
             * the solution would be another check against display url!
             * else if (requestData.indexOf(applicationLink.getDisplayUrl().toString()) == 0) {
             *  applink = applicationLink;
             *  break;
             * }
             *
             */
            if (requestData.indexOf(applicationLink.getRpcUrl().toString()) == 0) {
              applink = applicationLink;
              break;
            }
          }
        }
      

      Attachments

        1. jiraissues.jpg
          jiraissues.jpg
          99 kB
        2. JiraIssuesMacro.java
          38 kB

        Issue Links

          Activity

            People

              Unassigned Unassigned
              hsuhailah Hanis Suhailah (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: