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

Unable to create a Share Links page with certain links that contains space

    XMLWordPrintable

Details

    Description

      Issue Summary

      Confluence has a "Share a link" template that allows users to take content from the web and place it in a Confluence page.

      Some links that contains space (%20) will not work with the blueprint.

      Steps to Reproduce

      1. Make sure that Confluence has whitelist disabled for this replication
      2. Create page from blueprint > Choose "Share a link"
      3. Find a link that cotains space. (Sample link provided on CSP-261395)
      4. The "Share a link" popup will appear. Paste the sample link on the "Link" field. Example (not a working link)
        http://www.example.com/Upload/A%20sample%20doc.PDF
        
      5. Add title and click on the "create" button

      Expected Results

      The page is created

      Actual Results

      Page is not created. Seeing the following error message on the page:

      We can't create that blueprint right now.
      

      The below exception is thrown in the atlassian-confluence.log file:

      2019-11-05 10:59:00,803 ERROR [http-nio-26157-exec-1] [plugins.sharelinks.metaextractor.MasterLinkMetaDataExtractor] getHeadHtmlData Error in parse data: 
       -- referer: http://localhost:26157/display/~admin/test | url: /rest/create-dialog/1.0/content-blueprint/create-content | traceId: 877f4973116ffdf8 | userName: admin
      java.lang.RuntimeException: java.net.URISyntaxException: Illegal character in path at index 9: /Upload/1 Stock Preparation & Approach System 2010.PDF
      	at com.atlassian.confluence.util.http.httpclient.HttpClientHttpResponse.getResponseURI(HttpClientHttpResponse.java:31)
      	at com.atlassian.confluence.plugins.sharelinks.metaextractor.MasterLinkMetaDataExtractor.getResponseURI(MasterLinkMetaDataExtractor.java:151)
      	at com.atlassian.confluence.plugins.sharelinks.metaextractor.MasterLinkMetaDataExtractor.getHeadHtmlData(MasterLinkMetaDataExtractor.java:105)
      	at com.atlassian.confluence.plugins.sharelinks.metaextractor.MasterLinkMetaDataExtractor.parseMetaData(MasterLinkMetaDataExtractor.java:71)
      ....
      Caused by: java.net.URISyntaxException: Illegal character in path at index 9: /Upload/A sample doc.PDF
      	at java.net.URI$Parser.fail(URI.java:2848)
      	at java.net.URI$Parser.checkChars(URI.java:3021)
      ....
      

      Upon checking the browser console, the link is getting 500 error:

      Request URL:http://localhost:26157/rest/sharelinks/1.0/link?url=http%3A%2F%2Fwww.example.com.tw%2FUpload%2FA%2520sample%2520doc.PDF&_=1572922738734
      Request method:GET
      Remote address:127.0.0.1:26157
      Status code:
      500
      Version:HTTP/1.1
      Referrer Policy:no-referrer-when-downgrade
      
      Notes

      This issue was seen on external PDF links that contains space or %20. More examples can be seen from CSP-261395

      The issue does not exists with PDF links that contians spaces from Confluence.

      Upon checking, working links are encoded to %2520 in the browser console

      Workaround

      Before adding the link into the field, change all occurrence of "%20" into "%2520".

      Example, the link mentioned above will become the following:

      http://www.example.com/Upload/A%2520sample%2520doc.PDF
      

      Attachments

        Activity

          People

            Unassigned Unassigned
            mkhairuliana Monique Khairuliana (Inactive)
            Votes:
            3 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated: