Summary

      Confluence attachment is rendered as a broken link when viewed in JIRA Activity Stream gadget from JIRA and Activity Stream gadget from Confluence.

      Environment

      • Confluence 6.1.0, 6.1.2
      • JIRA 7.3.3, 7.3.5

      Steps to Reproduce

      1. Set up application links between JIRA and Confluence
      2. Add attachment in an existing Confluence page
      3. See JIRA Activity Stream gadget from JIRA Dashboard

      Expected Results

      The attachment is rendered correctly

      Actual Results

      • The attachment is rendered as a broken link
      • Opening the attachment in a new tab will result in a System Error page with below error:
      Cause
      java.lang.NullPointerException
      at com.atlassian.confluence.servlet.download.AttachmentDownload.getStreamForDownload(AttachmentDownload.java:105)
      Stack Trace:[hide]
      java.lang.NullPointerException
      at com.atlassian.confluence.servlet.download.AttachmentDownload.getStreamForDownload(AttachmentDownload.java:105)
      at com.atlassian.confluence.servlet.download.ServeAfterTransactionDownload$StreamResultCallback.doInTransaction(ServeAfterTransactionDownload.java:110)
      at org.springframework.transaction.support.TransactionTemplate.execute(TransactionTemplate.java:133)
      at com.atlassian.confluence.servlet.download.ServeAfterTransactionDownload.getStreamInTransaction(ServeAfterTransactionDownload.java:36)
      at com.atlassian.confluence.servlet.download.ServeAfterTransactionDownload.serveFile(ServeAfterTransactionDownload.java:42)

      Notes

      • JIRA Activity Stream gadget can render the attachment correctly when JIRA 7.3.3 is integrated with Confluence 5.10.5
      • The same URL is used for linking the attachment when integrated with Confluence 5.10.5 and 6.1.0, for example http://10.60.2.82:8090//download/attachments

      Workaround

      Open the attachment link in a new tab and remove one of the 2 forward slashes between the Base URL and download/attachments. E.g. from:

      to

        1. 123.jpg
          123.jpg
          31 kB
        2. 1234.JPG
          1234.JPG
          37 kB
        3. 12345.JPG
          12345.JPG
          52 kB
        4. 123456.JPG
          123456.JPG
          16 kB
        5. Screen Shot 2018-02-16 at 9.10.44 am.png
          Screen Shot 2018-02-16 at 9.10.44 am.png
          135 kB

            [CONFSERVER-52102] Broken Attachment Link in JIRA Activity Stream Gadget

            Bespin Global Admin added a comment - - edited

            Well, it still remains for confluence 7.0.3 with a very specific case.

            When someone shares the confluence page to others at least 2 people, then the gadget mentions the page is shared with the other person. However, the profile photo path of the person has two slashes such as https://example.com//download/attachments/5472359/user-avatar and cannot see the photo, logging the errors.

             

            --------------------------
            Attributes
            --------------------------
            javax.servlet.forward.request_uri: //download/attachments/5472359/user-avatar
            javax.servlet.forward.context_path:
            javax.servlet.forward.servlet_path: /download
            javax.servlet.forward.path_info: /attachments/5472359/user-avatar
            javax.servlet.forward.mapping: org.apache.catalina.core.ApplicationMapping$MappingImpl@376f34de
            javax.servlet.error.status_code: 500
            com.atlassian.confluence.impl.profiling.DecoratorTimings: com.atlassian.confluence.impl.profiling.DecoratorTimings@1fbc1721
            com.opensymphony.sitemesh.APPLIED_ONCE: true
            __cleanup_recursion_counter: 0
            javax.servlet.error.message:
            javax.servlet.error.servlet_name: file-server
            com.atlassian.confluence.web.filter.validateparam.RequestParamValidationFilter_already_filtered: true
            atlassian.core.seraph.original.url: /500page.jsp
            com.atlassian.labs.botkiller.BotKillerFilter: true
            com.atlassian.gzipfilter.GzipFilter_already_filtered: true
            Confluence-Request-Time: 1572058631091
            B3-TraceId: 6a9e3c11d71761
            loginfilter.already.filtered: true
            javax.servlet.error.request_uri: //download/attachments/5472359/user-avatar
            com.atlassian.core.filters.HeaderSanitisingFilter_already_filtered: true
            com.atlassian.prettyurls.filter.PrettyUrlsSiteMeshFixupFilter: true
            com.atlassian.confluence.web.ConfluenceJohnsonFilter_already_filtered: true
            javax.servlet.error.exception: java.lang.NullPointerException
            os_securityfilter_already_filtered: true
            com.atlassian.seraph.auth.LoginReason: OK
            com.atlassian.prettyurls.filter.PrettyUrlsSiteMeshFilter: true
            --------------------------
            Parameters
            --------------------------
            caused by: java.lang.NullPointerException
            at com.atlassian.confluence.servlet.download.AttachmentDownload.getStreamForDownload(AttachmentDownload.java:108)
             

            Bespin Global Admin added a comment - - edited Well, it still remains for confluence 7.0.3 with a very specific case. When someone shares the confluence page to others at least 2 people, then the gadget mentions the page is shared with the other person. However, the profile photo path of the person has two slashes such as https://example.com//download/attachments/5472359/user-avatar  and cannot see the photo, logging the errors.   -------------------------- Attributes -------------------------- javax.servlet.forward.request_uri: //download/attachments/5472359/user-avatar javax.servlet.forward.context_path: javax.servlet.forward.servlet_path: /download javax.servlet.forward.path_info: /attachments/5472359/user-avatar javax.servlet.forward.mapping: org.apache.catalina.core.ApplicationMapping$MappingImpl@376f34de javax.servlet.error.status_code: 500 com.atlassian.confluence.impl.profiling.DecoratorTimings: com.atlassian.confluence.impl.profiling.DecoratorTimings@1fbc1721 com.opensymphony.sitemesh.APPLIED_ONCE: true __cleanup_recursion_counter: 0 javax.servlet.error.message: javax.servlet.error.servlet_name: file-server com.atlassian.confluence.web.filter.validateparam.RequestParamValidationFilter_already_filtered: true atlassian.core.seraph.original.url: /500page.jsp com.atlassian.labs.botkiller.BotKillerFilter: true com.atlassian.gzipfilter.GzipFilter_already_filtered: true Confluence-Request-Time: 1572058631091 B3-TraceId: 6a9e3c11d71761 loginfilter.already.filtered: true javax.servlet.error.request_uri: //download/attachments/5472359/user-avatar com.atlassian.core.filters.HeaderSanitisingFilter_already_filtered: true com.atlassian.prettyurls.filter.PrettyUrlsSiteMeshFixupFilter: true com.atlassian.confluence.web.ConfluenceJohnsonFilter_already_filtered: true javax.servlet.error.exception: java.lang.NullPointerException os_securityfilter_already_filtered: true com.atlassian.seraph.auth.LoginReason: OK com.atlassian.prettyurls.filter.PrettyUrlsSiteMeshFilter: true -------------------------- Parameters -------------------------- caused by: java.lang.NullPointerException at com.atlassian.confluence.servlet.download.AttachmentDownload.getStreamForDownload(AttachmentDownload.java:108)

            A fix for this issue is available to Server and Data Center customers in Confluence 6.14.0
            Upgrade now or check out the Release Notes to see what other issues are resolved.

            Zhenhuan Zhou (Inactive) added a comment - A fix for this issue is available to Server and Data Center customers in Confluence 6.14.0 Upgrade now or check out the Release Notes to see what other issues are resolved.

            Jira 7.12.1 + Confluence 6.12.0 not affected

            Bulanov Maxim added a comment - Jira 7.12.1 + Confluence 6.12.0 not affected

            Dmitriy Alekseev added a comment - - edited

            Workaround for HAproxy >1.6:

            acl has_multiple_slash path_reg /{2,}
            http-request redirect code 301 location http://%[hdr(host)]%[url,regsub(/+,/,g)] if has_multiple_slash
            

             Workaround for nginx:
            http://nginx.org/ru/docs/http/ngx_http_core_module.html#merge_slashes

            Dmitriy Alekseev added a comment - - edited Workaround for HAproxy >1.6: acl has_multiple_slash path_reg /{2,} http-request redirect code 301 location http: //%[hdr(host)]%[url,regsub(/+,/,g)] if has_multiple_slash  Workaround for nginx: http://nginx.org/ru/docs/http/ngx_http_core_module.html#merge_slashes

            +1

            • Jira: 7.6.1
            • Confluence: 6.5.2

            Igors Yansons added a comment - +1 Jira: 7.6.1 Confluence: 6.5.2

            +1

            • jira: v7.10.2
            • confuence: 6.10.0

            Martin Virág added a comment - +1 jira: v7.10.2 confuence: 6.10.0

            +1 with Jira 7.10.0 + Confluence 6.9.0

            Bulanov Maxim added a comment - +1 with Jira 7.10.0 + Confluence 6.9.0

            Just started happening out of the blue on our setup: Jira 7.7.0, Confluence  6.6.2.

            No Nginx.

             

            Ithai Swart added a comment - Just started happening out of the blue on our setup: Jira 7.7.0, Confluence  6.6.2. No Nginx.  

            same problem here: Jira 7.10, confluence 6.7.2

            Morten Byom added a comment - same problem here: Jira 7.10, confluence 6.7.2

            w.szumial1043431334 added a comment -

            The same in Jira 7.6.4 + Confluence 6.6.4 

            w.szumial1043431334 added a comment - The same in Jira 7.6.4 + Confluence 6.6.4 

              dluong Duy Truong Luong
              znoorsazali Zul NS [Atlassian]
              Affected customers:
              82 This affects my team
              Watchers:
              92 Start watching this issue

                Created:
                Updated:
                Resolved: