Uploaded image for project: 'Confluence Cloud'
  1. Confluence Cloud
  2. CONFCLOUD-70167

JIRA Issue information is missing, only link shows up in PDF export

      Issue Summary

      Jira Issue macros don't show issue information like key, status, and summary in PDF Export. Only the Issue link shows up.

      Steps to Reproduce

      1. Create a page. 
      2. Add a few Jira Issues to it. Publish the page
      3. Edit the page and publish the page without changing anything.
      4. Get the PDF Export.

      Expected Results

      It should show like:

      Actual Results

      Workaround

      Currently, there is no known workaround for this behavior. A workaround will be added here when available

            [CONFCLOUD-70167] JIRA Issue information is missing, only link shows up in PDF export

            We haven't been able to reproduce. For a workaround, please edit and re-publish the page to get it working.

            Tushar Mahule added a comment - We haven't been able to reproduce. For a workaround, please edit and re-publish the page to get it working.

            Hi Harald, you are quite right.  Its not too slick but we got round this by having a standard list of old issues we can temporarily place in the document to enable us to grab the JQL, once we have it and have a summary table created we remove the old tasks from the document. Its another step but only takes a minute and is a one time step.

            Dave Jenkins added a comment - Hi Harald, you are quite right.  Its not too slick but we got round this by having a standard list of old issues we can temporarily place in the document to enable us to grab the JQL, once we have it and have a summary table created we remove the old tasks from the document. Its another step but only takes a minute and is a one time step.

            Harald added a comment -

            We have the same problem as some other users. We also communicate with external customers via export. For us the output of the URL is also not useful to our customers. 

            We have found, the editing of pages can also affect the link formatting on the page, alongside the differences between copied Jira links and those that are using the issue macro. This problem is something that Atlassian needs to address in the new editor.
            One more addition to this comment:
            "At top of the document (in view mode) you can expand the list of Jira issues contained in the doc. If you click 'View X more in System Jira' you can grab the JQL for the list of tasks within your document."
            'View X more in System Jira' unfortunately only appears when more than 6 or 7 issue are displayed. Otherwise the link is not available. 
            But otherwise this is a good solution to display all operations on the page in one overview.

            Harald added a comment - We have the same problem as some other users. We also communicate with external customers via export. For us the output of the URL is also not useful to our customers.  We have found, the editing of pages can also affect the link formatting on the page, alongside the differences between copied Jira links and those that are using the issue macro. This problem is something that Atlassian needs to address in the new editor. One more addition to this comment: "At top of the document (in view mode) you can expand the list of Jira issues contained in the doc. If you click 'View X more in System Jira' you can grab the JQL for the list of tasks within your document." 'View X more in System Jira' unfortunately only appears when more than 6 or 7 issue are displayed. Otherwise the link is not available.  But otherwise this is a good solution to display all operations on the page in one overview.

            For anyone struggling with this we have a quasi-workaround, its not ideal but does render properly on pdf exports and has worked well for our clients s0 far.

            1. At top of the document (in view mode) you can expand the list of Jira issues contained in the doc. If you click 'View X more in System Jira' you can grab the JQL for the list of tasks within your document.
            2. Edit your document,  add a Summary Table somewhere using the Jira macro. Use the JQL from step 1. A nice table will then show in your document listing all the issues with their status. PDF Export renders the issue statuses correctly in the table (though the links in the document body still just show as urls - grrrr) but at least there is a summary table listing the proper statuses.

            Hope it helps, its working for us to share more useful docs with non Jira users while this bug gets fixed.

             

            Dave Jenkins added a comment - For anyone struggling with this we have a quasi-workaround, its not ideal but does render properly on pdf exports and has worked well for our clients s0 far. At top of the document (in view mode) you can expand the list of Jira issues contained in the doc. If you click 'View X more in System Jira' you can grab the JQL for the list of tasks within your document. Edit your document,  add a Summary Table somewhere using the Jira macro. Use the JQL from step 1. A nice table will then show in your document listing all the issues with their status. PDF Export renders the issue statuses correctly in the table (though the links in the document body still just show as urls - grrrr) but at least there is a summary table listing the proper statuses. Hope it helps, its working for us to share more useful docs with non Jira users while this bug gets fixed.  

            We are also noticing this is not displaying the issue correctly on the include macro when the page is published.  In edit view it shows the Jira issue as a card correctly or displays the issue type, summary with status correctly but when published it reverts to just displaying the full url.  Agreed that is not a low priority as is disrupts being able to report out on a projects progress from confluence. 

            Julian Governale added a comment - We are also noticing this is not displaying the issue correctly on the include macro when the page is published.  In edit view it shows the Jira issue as a card correctly or displays the issue type, summary with status correctly but when published it reverts to just displaying the full url.  Agreed that is not a low priority as is disrupts being able to report out on a projects progress from confluence. 

            Dave Jenkins added a comment - - edited

            Further more i wouldnt say this is a LOW priority bug, the whole point of Confluence is sharing project information, if we cant show a client accurate issue status without adding them as a user, its no use.

            The odd thing here, is the pdf shows properly on the first export after creating the issue links, its only when you go back in and resave then export again it fails.

            Dave Jenkins added a comment - - edited Further more i wouldnt say this is a LOW priority bug, the whole point of Confluence is sharing project information, if we cant show a client accurate issue status without adding them as a user, its no use. The odd thing here, is the pdf shows properly on the first export after creating the issue links, its only when you go back in and resave then export again it fails.

            Dave Jenkins added a comment - - edited

            Agreed this is a showstopper for us, the only purpose to export pdfs is to share it outside your team, if the status links don't work its useless.

            Dave Jenkins added a comment - - edited Agreed this is a showstopper for us, the only purpose to export pdfs is to share it outside your team, if the status links don't work its useless.

            This is a huge issue for my company as well, we want to export documentation to external clients who do not have access to our Jira. Ideally there would be an option to export the macro text as display (JiraId - Issue description) instead of the URL which is useless to our clients.

            Harvey Jules Nett added a comment - This is a huge issue for my company as well, we want to export documentation to external clients who do not have access to our Jira. Ideally there would be an option to export the macro text as display (JiraId - Issue description) instead of the URL which is useless to our clients.

            I am noticing this exact behavior but surfacing when using the Include Page macro. Single Jira Issues which are normally shown as Key Summary and Status are replaced as URLs when rendered as an Include Page in other pages.

            Pete Dunham added a comment - I am noticing this exact behavior but surfacing when using the Include Page macro. Single Jira Issues which are normally shown as Key Summary and Status are replaced as URLs when rendered as an Include Page in other pages.

            Based on the above findings, I have been able to successfully test a workaround script which leverages the API to fetch an affected page, replace Jira hyperlinks with Jira macro references, and save it back to the storage format. I am attaching a copy of this script as a proof of concept, though please do note:

            • The script requires configuration before usage, and can only be used to update one page at a time. It also assumes a 1:1 mapping between Confluence and Jira. For more complex scenarios, this would need to be adapted.
            • This has only been tested in a small proof of concept scenario. There may be limitations with large pages, or pages with complex structures. No warranty is implied - please review and test thoroughly before using.

             

            # Atlassian Python API from https://atlassian-python-api.readthedocs.io/
            from atlassian import Confluence
            
            # lxml from https://lxml.de/
            from lxml import etree as ET
            import re
            
            # Automated workaround for https://jira.atlassian.com/browse/CONFCLOUD-70167
            # As per CONFCLOUD-70167, Confluence Cloud editor strips out Jira macro references when editing a saved page, and
            # replaces them with hyperlinks. Though this appears to look OK in browsers, PDF & Word exports are rendered with
            # hyperlinked URLs instead of Jira issue keys/summaries.
            # This script needs to be configured to target a particular Confluence page and Jira project. When run, it fetches
            # the storage format for the affected page, looks for hyerlinks to the target Jira project and replaces them with
            # Jira macro references.
            
            # Confluence config
            CONF_URL = "https://something.atlassian.net" # FIXME
            CONF_USER = "" # FIXME
            CONF_TOKEN = "" # FIXME
            CONF_TARGET_SPACE = "" # FIXME
            CONF_TARGET_PAGE = "" # FIXME
            
            # Jira config
            JIRA_URL = "something.atlassian.net" # FIXME
            JIRA_TARGET_PROJECT = "" # FIXME
            JIRA_NAME = "System JIRA" # FIXME
            JIRA_SERVER_ID = "" # FIXME
            
            # Dummy namespace for XML processing
            NSMAP = {"ac": "http://example.com"}
            
            # Utility to build macro node to replace Jira links
            def buildMacroNode(key):
            	def _ns(val):
            		return "{%s}%s" % (NSMAP["ac"], val)
            	def _buildParam(name, value):
            		serverParam = root.makeelement(_ns("parameter"), {_ns("name"): name}, nsmap=NSMAP)
            		serverParam.text = value
            		return serverParam
            	macro = root.makeelement(_ns("structured-macro"), {_ns("name"): "jira", _ns("schema-version"): "1"}, nsmap=NSMAP)
            	macro.append(_buildParam("server", JIRA_NAME))
            	macro.append(_buildParam("columns", "key,summary,type,created,updated,due,assignee,reporter,priority,status,resolution"))
            	macro.append(_buildParam("serverId", JIRA_SERVER_ID))
            	macro.append(_buildParam("key", key))
            	return macro
            
            # Connect to Confluence
            confluence = Confluence(
            	url=CONF_URL,
            	username=CONF_USER,
            	password=CONF_TOKEN
            )
            
            # Read target page storage and convert into XML structure
            pg = confluence.get_page_by_title(CONF_TARGET_SPACE, CONF_TARGET_PAGE, expand="body.storage")
            root = ET.fromstring("<doc xmlns:ac=\"http://example.com\">%s</doc>" % pg['body']['storage']['value'])
            
            jiraKeyPattern = "%s/browse/(%s-\d+)" % (JIRA_URL, JIRA_TARGET_PROJECT)
            
            # Find links to issues in target Jira project
            links = root.findall(".//a")
            jiraLinks = [l for l in links if "%s/browse/%s-" % (JIRA_URL, JIRA_TARGET_PROJECT) in l.attrib['href']]
            for link in jiraLinks:
            	matches = re.findall(jiraKeyPattern, link.attrib['href'])
            	if 1 == len(matches):
            		key = matches[0]
            		# Replace with macro node
            		macro = buildMacroNode(key)
            		link.getparent().replace(link, macro)
            
            
            updatedStorage = re.sub("^<doc xmlns:ac=\"http://example.com\">", "", ET.tostring(root, encoding=str))
            updatedStorage = re.sub("</doc>$", "", updatedStorage)
            
            # FIXME: Uncomment this when ready to run
            #confluence.update_page(pg['id'], pg['title'], updatedStorage, representation="storage")
            

            Sham Chukoury added a comment - Based on the above findings, I have been able to successfully test a workaround script which leverages the API to fetch an affected page, replace Jira hyperlinks with Jira macro references, and save it back to the storage format. I am attaching a copy of this script as a proof of concept, though please do note: The script requires configuration before usage, and can only be used to update one page at a time. It also assumes a 1:1 mapping between Confluence and Jira. For more complex scenarios, this would need to be adapted. This has only been tested in a small proof of concept scenario. There may be limitations with large pages, or pages with complex structures. No warranty is implied - please review and test thoroughly before using.   # Atlassian Python API from https://atlassian-python-api.readthedocs.io/ from atlassian import Confluence # lxml from https://lxml.de/ from lxml import etree as ET import re # Automated workaround for https://jira.atlassian.com/browse/CONFCLOUD-70167 # As per CONFCLOUD-70167, Confluence Cloud editor strips out Jira macro references when editing a saved page, and # replaces them with hyperlinks. Though this appears to look OK in browsers, PDF & Word exports are rendered with # hyperlinked URLs instead of Jira issue keys/summaries. # This script needs to be configured to target a particular Confluence page and Jira project. When run, it fetches # the storage format for the affected page, looks for hyerlinks to the target Jira project and replaces them with # Jira macro references. # Confluence config CONF_URL = "https://something.atlassian.net" # FIXME CONF_USER = "" # FIXME CONF_TOKEN = "" # FIXME CONF_TARGET_SPACE = "" # FIXME CONF_TARGET_PAGE = "" # FIXME # Jira config JIRA_URL = "something.atlassian.net" # FIXME JIRA_TARGET_PROJECT = "" # FIXME JIRA_NAME = "System JIRA" # FIXME JIRA_SERVER_ID = "" # FIXME # Dummy namespace for XML processing NSMAP = { "ac" : "http://example.com" } # Utility to build macro node to replace Jira links def buildMacroNode(key): def _ns(val): return "{%s}%s" % (NSMAP[ "ac" ], val) def _buildParam(name, value): serverParam = root.makeelement(_ns( "parameter" ), {_ns( "name" ): name}, nsmap=NSMAP) serverParam.text = value return serverParam macro = root.makeelement(_ns( "structured-macro" ), {_ns( "name" ): "jira" , _ns( "schema-version" ): "1" }, nsmap=NSMAP) macro.append(_buildParam( "server" , JIRA_NAME)) macro.append(_buildParam( "columns" , "key,summary, type ,created,updated,due,assignee,reporter,priority,status,resolution" )) macro.append(_buildParam( "serverId" , JIRA_SERVER_ID)) macro.append(_buildParam( "key" , key)) return macro # Connect to Confluence confluence = Confluence( url=CONF_URL, username=CONF_USER, password=CONF_TOKEN ) # Read target page storage and convert into XML structure pg = confluence.get_page_by_title(CONF_TARGET_SPACE, CONF_TARGET_PAGE, expand= "body.storage" ) root = ET.fromstring( "<doc xmlns:ac=\" http://example.com\ ">%s</doc>" % pg[ 'body' ][ 'storage' ][ 'value' ]) jiraKeyPattern = "%s/browse/(%s-\d+)" % (JIRA_URL, JIRA_TARGET_PROJECT) # Find links to issues in target Jira project links = root.findall( ".//a" ) jiraLinks = [l for l in links if "%s/browse/%s-" % (JIRA_URL, JIRA_TARGET_PROJECT) in l.attrib[ 'href' ]] for link in jiraLinks: matches = re.findall(jiraKeyPattern, link.attrib[ 'href' ]) if 1 == len (matches): key = matches[0] # Replace with macro node macro = buildMacroNode(key) link.getparent().replace(link, macro) updatedStorage = re.sub( "^<doc xmlns:ac=\" http://example.com\ ">" , "", ET.tostring(root, encoding= str )) updatedStorage = re.sub( "</doc>$" , "", updatedStorage) # FIXME: Uncomment this when ready to run #confluence.update_page(pg[ ' id ' ], pg[ 'title' ], updatedStorage, representation= "storage" )

              105094f35dd0 Nitish Midha
              skhanna@atlassian.com Shubham Khanna
              Affected customers:
              42 This affects my team
              Watchers:
              44 Start watching this issue

                Created:
                Updated:
                Resolved: