live search macro have problems with filenames with blankspaces
Asked by Mark Wittig:

If I use the live search macro to find a file, confluence don't download this file if the filename has blank spaces. The macro find the file correctly but if I click on the result I get something like this:
> The page you requested could not be found. Possible reasons:
>
> The page does not exist.
>
> The page exists, but you are not authorized to view it.


Answers:
author: Davin Studer
body: This is a [known bug](https://jira.atlassian.com/browse/CONF-32869?filter=-4&jql=text%20~%20%22%252520%22%20ORDER%20BY%20createdDate%20DESC) that hasn't been fixed yet. This is how we have worked around it in our environment. Add this to the "after body" section in custom html in Confluence admin. Just replace the {spakey} and {pagename} sections with your page that has the live search macro ... this keeps it from firing on ever page and possibly causing issues.

```
&lt;script type="text/javascript"&gt;//This is to bandaid an issue with the livesearch macro where spaces in attachment names are being changed from %20 to %2520.AJS.toInit(function(){	var url = window.location.pathname;	if(url.indexOf('display/{spacekey}/{pagename}') != -1) {		var runBinderComponentsOld = AJS.Confluence.runBinderComponents;		AJS.Confluence.runBinderComponents = function(){			runBinderComponentsOld();			AJS.$('.search-macro li[data-content-type="attachment"] a').each(function(){				this.href = this.href.replace(/%2520/g, '%20');			});		}	}});&lt;/script&gt;
```

comments: author: Mark Wittig
body: Thank you Davin for this work around. I hope Atlassian will fix this problem in the next releases.


author: Daniel Ray
body: It still has not been fixed by 5.7.4. Is there an option to fix this with out having to do it for every space? I would rather not have to add this for every space we have or might have in the future.


author: Davin Studer
body: I believe it got fixed in 5.8.5 or something like that.


author: Mark Wittig
body: Thank you Davin for this work around. I hope Atlassian will fix this problem in the next releases.


author: Mark Wittig
body: Hi Guilherme, I'm using Confluence 5.5.1. The URL that confluence wants to open is like:

filename is: "Here we are 04-2014.docx"

[](https://my.domain.com/mod.wiki/download/attachments/20850248/filenamepartone%2520filenameparttwo%2520filenamepartthree%252004-2014.docx?version=1&modificationDate=1407412380318&api=v2)[https://my.domain.com/mod.wiki/download/attachments/20850248/Here%2520we%2520are%252004-2014.docx?version=1\&modificationDate=1407412380318\&api=v2](https://my.domain.com/mod.wiki/download/attachments/20850248/Here%252520we%252520are%25252004-2014.docx?version=1&modificationDate=1407412380318&api=v2)

I think the blank space aliases in the URL are wrong:

* in URL given: "%2520"
* correct alias: "%20"

If I use the global search (for the entire wiki) I get a link with the correct blank space aliases.


author: Guilherme Nedel [Atlassian]
body: Hello Mark, while testing with Confluence 5.4.4 and livesearch using an imaged named "kamakura 3.jpg" I was able to download the item.

Would it be possible to provide a link to the file in question, along with the Confluence version you are as means to enable further understanding of the scenario?