Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

live search macro have problems with filenames with blankspaces

Mark Wittig August 11, 2014

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.

4 answers

1 vote
Davin Studer
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
August 11, 2014

This is a known bug 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.

<script type="text/javascript">
//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');
			});
		}
	}
});
</script>

Mark Wittig August 12, 2014

Thank you Davin for this work around. I hope Atlassian will fix this problem in the next releases.

Daniel Ray September 16, 2015

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.

Davin Studer
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
September 17, 2015

I believe it got fixed in 5.8.5 or something like that.

0 votes
Mark Wittig August 12, 2014

Thank you Davin for this work around. I hope Atlassian will fix this problem in the next releases.

0 votes
Mark Wittig August 11, 2014

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/Here%2520we%2520are%252004-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.

0 votes
Guilherme Nedel [Atlassian]
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
August 11, 2014

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?

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events