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

Live Search Macro fails to open attachments that contain spaces in the name.

      When a user searches for an attachment that contain spaces the macro will work fine, however if he click on that attachment it will result in a page not find error.

      Steps to reproduce:

      1. Create a space and attach the to it the files "nospace.doc" and "with space.doc".
      2. Now create a new page and add the Live Search Macro.
      3. Search for the "nospace.doc", and click on it.
      4. File will open fine.
      5. Go back to the page where you added the Live Search Macro and search for the "with space.doc"
      6. You will get the page not found error.

      Workaround:

      If you remove spaces in the name of the attachment you will be able to open it using live search macro.

      Notes:

      If you go to Confluence Search Page and search for the attachment this will be the URL you will get:

      http://localhost:8090/download/attachments/1540098/with%20space.doc?version=1&modificationDate=1394227894728&api=v2 
      

      However when opening the file with Live Search Macro you will get below one in return:

      http://localhost:8090/download/attachments/1540098/with%2520space.doc?version=1&modificationDate=1394227894728&api=v2
      

      For some reason when using Live Search Macro the "%20" get replaced with "%2520"

        1. nospace.doc
          9 kB
        2. pagenotfound.PNG
          pagenotfound.PNG
          22 kB
        3. with space.doc
          9 kB

            [CONFSERVER-32869] Live Search Macro fails to open attachments that contain spaces in the name.

            Confirmed, finally fixed in 5.8.5

            Thx

            Jan-Peter Rusch added a comment - Confirmed, finally fixed in 5.8.5 Thx

            But fixed with 5.8.5

            Alexander Schätzle added a comment - But fixed with 5.8.5

            Not fixed with 5.8.2

            Jan-Peter Rusch added a comment - Not fixed with 5.8.2

            Really poor that this issue has been ignored for so long. Thank you Davin Studer for giving a shortcut and doing Confluence's job for them

            Jonathan Lin added a comment - Really poor that this issue has been ignored for so long. Thank you Davin Studer for giving a shortcut and doing Confluence's job for them

            Thanks for fix it, but in which version of Confluence will be released?

            Libor Tvrdík added a comment - Thanks for fix it, but in which version of Confluence will be released?

            JP added a comment -

            Any progress on this issue?

            JP added a comment - Any progress on this issue?

            Affects Version 5.7.1 too.

            The cause of the problem is most likely double URL encoding, somewhere in the guts of the live search macro.

            The common space character is encoded as %20.
            The % character is encoded as %25.

            When an URL already has a %20 in it and gets urlencoded again, that transforms the %20 to %2520.

            Deleted Account (Inactive) added a comment - Affects Version 5.7.1 too. The cause of the problem is most likely double URL encoding, somewhere in the guts of the live search macro. The common space character is encoded as %20. The % character is encoded as %25. When an URL already has a %20 in it and gets urlencoded again, that transforms the %20 to %2520.

            Please fix it!

            Alexander Schätzle added a comment - Please fix it!

            Still not working with 5.7.

            REALLY annoying

            Jan-Peter Rusch added a comment - Still not working with 5.7. REALLY annoying

            For all German characters like äüöÄÜÖß

            add:
            AJS.$('.search-macro li[data-content-type="attachment"] a').each(function()

            { this.href = this.href.replace(/%2520/g, '%20'); this.href = this.href.replace(/%2584/g, '%84'); this.href = this.href.replace(/%2596/g, '%96'); this.href = this.href.replace(/%259C/g, '%9C'); this.href = this.href.replace(/%259F/g, '%9F'); this.href = this.href.replace(/%25A4/g, '%A4'); this.href = this.href.replace(/%25B6/g, '%B6'); this.href = this.href.replace(/%25BC/g, '%BC'); this.href = this.href.replace(/%25C3/g, '%C3'); }

            );

            Andreas Freidel added a comment - For all German characters like äüöÄÜÖß add: AJS.$('.search-macro li [data-content-type="attachment"] a').each(function() { this.href = this.href.replace(/%2520/g, '%20'); this.href = this.href.replace(/%2584/g, '%84'); this.href = this.href.replace(/%2596/g, '%96'); this.href = this.href.replace(/%259C/g, '%9C'); this.href = this.href.replace(/%259F/g, '%9F'); this.href = this.href.replace(/%25A4/g, '%A4'); this.href = this.href.replace(/%25B6/g, '%B6'); this.href = this.href.replace(/%25BC/g, '%BC'); this.href = this.href.replace(/%25C3/g, '%C3'); } );

              kma@atlassian.com Khanh Ma (Inactive)
              dluvison Deividi Luvison (Inactive)
              Affected customers:
              21 This affects my team
              Watchers:
              30 Start watching this issue

                Created:
                Updated:
                Resolved: