Uploaded image for project: 'Jira Service Management Data Center'
  1. Jira Service Management Data Center
  2. JSDSERVER-6707

Incorrect resources are loaded based on condition in Customer Portal

      Issue Summary

      Atlassian plugin vendor are extending SimpleUrlReadingCondition according to https://bitbucket.org/atlassian_tutorial/tutorial-licensed-conditions/src/master/src/main/java/com/example/plugins/conditions/IsPluginLicensedCondition.java. When using this condition to load a web-resource in the customerportal context, the wrong resource is loaded.

      As a consequence:

      • a lot of Service Desk portal URLs are corrupted since the string "customer/portal/undefined/servicedesk" is being mistakenly added to it, and accessing such URL returns a 404 error with the message "Oops, you've found a dead link".
      • some functionalities from the customer portal will fail to work: for example, icon/avatar images might not be loaded on the customer, workflow transitions might fail on the customer portal, etc...

      For example:

      • Customer Portal Icons (Avatar):
        • A normal icon URL should be like this:
          <JIRA_BASE_URL>/servicedesk/customershim/secure/viewavatar?avatarType=SD_REQTYPE&avatarId=10610
          
        • However, when the bug occurs, the URL is modified to the following invalid URL:
          <JIRA_BASE_URL>/servicedesk/customer/undefined/servicedesk/customershim/secure/viewavatar?avatarType=SD_REQTYPE&avatarId=10610
          
      • Customer Portal Transition
        • A normal transition URL should be like this:
          <JIRA_BASE_URL>/rest/servicedesk/1/customer/requests/transition
          
        • However, when the bug occurs, the URL is modified to the following invalid URL:
          <JIRA_BASE_URL>/servicedesk/customer/portal/37/undefined/rest/servicedesk/1/customer/requests/transition
          

      Steps to Reproduce

      1. Create a test plugin that uses a condition to load resources on the customer portal (see screenshots/attachments)

      atlassian-plugin.xml snippet

          <web-resource key="test-true" name="test-true">
              <resource type="download" name="condition-true.js" location="/js/condition-true.js"/>
              <context>customerportal</context>
              <condition class="com.atlassian.test.impl.TestCondition"/>
          </web-resource>
      
          <web-resource key="test-false" name="test-false">
              <resource type="download" name="condition-false.js" location="/js/condition-false.js"/>
              <context>customerportal</context>
              <condition class="com.atlassian.test.impl.TestCondition" invert="true"/>
          </web-resource>
      

      Expected Results

      The resource associated with the TestCondition being true is loaded

      Actual Results

      The resource associated with the TestCondition being false is loaded

      Workaround

      Enable the feature flag sd.frontend.legacy.webresource.loading.customerportal.enabled:

      1. Go to Dark feature page (<baseURL>/secure/admin/SiteDarkFeatures!default.jspa)
      2. Add the following dark feature flag: sd.frontend.legacy.webresource.loading.customerportal.enabled

          Form Name

            [JSDSERVER-6707] Incorrect resources are loaded based on condition in Customer Portal

            Rinish made changes -
            Remote Link Original: This issue links to "JSDS-5494 (Bulldog)" [ 467347 ] New: This issue links to "JSMDC-5494 (JIRA Server (Bulldog))" [ 467347 ]
            Rinish made changes -
            Remote Link Original: This issue links to "JSDS-7986 (JIRA Server (Bulldog))" [ 522593 ] New: This issue links to "JSMDC-7986 (JIRA Server (Bulldog))" [ 522593 ]
            Charlie Marriott made changes -
            Remote Link New: This issue links to "Page (Confluence)" [ 617364 ]
            Evern Fong made changes -
            Affects Version/s New: 4.13.11 [ 97695 ]
            Alex Cooksey made changes -
            Remote Link New: This issue links to "Page (Confluence)" [ 556416 ]
            Lenard Bernardo (Inactive) made changes -
            Remote Link Original: This issue links to "Page (Confluence)" [ 533141 ]
            Lenard Bernardo (Inactive) made changes -
            Remote Link New: This issue links to "Page (Confluence)" [ 533141 ]
            Charlie Marriott made changes -
            Resolution New: Fixed [ 1 ]
            Status Original: Waiting for Release [ 12075 ] New: Closed [ 6 ]
            Bugfix Automation Bot made changes -
            Support reference count Original: 38 New: 39
            Bugfix Automation Bot made changes -
            Support reference count Original: 37 New: 38

              Unassigned Unassigned
              c7dfe7a6b4d2 Heiko Gerlach
              Affected customers:
              17 This affects my team
              Watchers:
              61 Start watching this issue

                Created:
                Updated:
                Resolved: