AtlasOfLivingAustralia/downloads-plugin

URISyntaxException: Illegal character in query

Closed this issue · 1 comments

The query URL for downloads is not currently being URL encoded correctly, creating issues when the users query contains a character that should be encoded in a valid URL.

The following query is another example (in addition to issue #26 ), where a users query is causing the downloads-plugin to fail and not allow users to access their download due to poor URL encoding practices by the ALA software (possibly biocache-service caused initially, but tracking here as this is where the error shows up):

https://biocache-beta.ala.org.au/download/doi?doi=10.26197%2F5b6e61ae909e7

The download on doi.ala.org.au in this case is fine when resolved using the official DOI resolver:

https://doi.org/10.26197/5b6e61ae909e7

That validly redirects as expected to:

https://doi.ala.org.au/doi/4a678f8b-af98-4b99-88ba-209c6066b483

2018-08-13 08:37:02.910 ERROR --- [bio-8080-exec-7] StackTrace                               : Full Stack Trace:

org.grails.taglib.GrailsTagException: [views/download/doi.gsp:25] Error executing tag <downloads:formatSearchQuery>: Illegal character in query at index 129: https://biocache-beta.ala.org.au/occurrences/search?q=*%3A*&fq=species_group%3A%22Plants%22&wkt=MULTIPOLYGON(((117.93686628298018 -35.08208259312442,117.93208122209762 -35.082161610592784,117.93187737421249 -35.085287129061264,117.93249964670395 -35.08544515771328,117.93320774988388 -35.08535736405552,117.9336261744902 -35.08543637835176,117.93419480280134 -35.08562952408703,117.93494582132553 -35.08551539257147,117.9353749747679 -35.08515543828403,117.93571829752182 -35.084532099053554,117.93643712953781 -35.085322246565944,117.9380035396025 -35.08491839434922,117.93686628298018 -35.08208259312442)))
	at org.grails.gsp.GroovyPage.throwRootCause(GroovyPage.java:443)
	at org.grails.gsp.GroovyPage.invokeTag(GroovyPage.java:386)
	at gsp_downloads_plugin_downloaddoi_gsp$_run_closure2.doCall(gsp_downloads_plugin_downloaddoi_gsp.groovy:62)
	at org.grails.taglib.TagBodyClosure.executeClosure(TagBodyClosure.java:200)
	at org.grails.taglib.TagBodyClosure.captureClosureOutput(TagBodyClosure.java:102)
	at org.grails.taglib.TagBodyClosure.call(TagBodyClosure.java:213)
	at org.grails.plugins.web.taglib.SitemeshTagLib.captureTagContent(SitemeshTagLib.groovy:48)
	at org.grails.plugins.web.taglib.SitemeshTagLib$_closure3.doCall(SitemeshTagLib.groovy:156)
	at org.grails.gsp.GroovyPage.invokeTagLibClosure(GroovyPage.java:417)
	at org.grails.gsp.GroovyPage.invokeTag(GroovyPage.java:335)
	at gsp_downloads_plugin_downloaddoi_gsp.run(gsp_downloads_plugin_downloaddoi_gsp.groovy:105)
	at org.grails.gsp.GroovyPageWritable.doWriteTo(GroovyPageWritable.java:162)
	at org.grails.gsp.GroovyPageWritable.writeTo(GroovyPageWritable.java:82)
	at org.grails.web.servlet.view.GroovyPageView.renderTemplate(GroovyPageView.java:76)
	at org.grails.web.servlet.view.AbstractGrailsView.renderWithinGrailsWebRequest(AbstractGrailsView.java:71)
	at org.grails.web.servlet.view.AbstractGrailsView.renderMergedOutputModel(AbstractGrailsView.java:55)
	at org.springframework.web.servlet.view.AbstractView.render(AbstractView.java:303)
	at org.grails.web.sitemesh.GrailsLayoutView.renderInnerView(GrailsLayoutView.java:150)
	at org.grails.web.sitemesh.GrailsLayoutView.obtainContent(GrailsLayoutView.java:128)
	at org.grails.web.sitemesh.GrailsLayoutView.renderTemplate(GrailsLayoutView.java:63)
	at org.grails.web.servlet.view.AbstractGrailsView.renderWithinGrailsWebRequest(AbstractGrailsView.java:71)
	at org.grails.web.servlet.view.AbstractGrailsView.renderMergedOutputModel(AbstractGrailsView.java:55)
	at org.springframework.web.servlet.view.AbstractView.render(AbstractView.java:303)
	at org.springframework.web.servlet.DispatcherServlet.render(DispatcherServlet.java:1286)
	at org.springframework.web.servlet.DispatcherServlet.processDispatchResult(DispatcherServlet.java:1041)
	at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:984)
	at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:901)
	at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:970)
	at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:861)
	at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:846)
	at org.springframework.boot.web.filter.ApplicationContextHeaderFilter.doFilterInternal(ApplicationContextHeaderFilter.java:55)
	at org.grails.web.servlet.mvc.GrailsWebRequestFilter.doFilterInternal(GrailsWebRequestFilter.java:77)
	at au.org.ala.cas.client.AlaHttpServletRequestWrapperFilter.doFilter(AlaHttpServletRequestWrapperFilter.java:81)
	at au.org.ala.cas.client.UriFilter.doFilter(UriFilter.java:188)
	at org.jasig.cas.client.validation.AbstractTicketValidationFilter.doFilter(AbstractTicketValidationFilter.java:236)
	at au.org.ala.cas.client.UriFilter.doFilter(UriFilter.java:188)
	at org.jasig.cas.client.authentication.AuthenticationFilter.doFilter(AuthenticationFilter.java:155)
	at au.org.ala.cas.client.UriFilter.doFilter(UriFilter.java:188)
	at org.jasig.cas.client.session.SingleSignOutFilter.doFilter(SingleSignOutFilter.java:97)
	at org.grails.web.filters.HiddenHttpMethodFilter.doFilterInternal(HiddenHttpMethodFilter.java:67)
	at org.springframework.boot.web.support.ErrorPageFilter.doFilter(ErrorPageFilter.java:117)
	at org.springframework.boot.web.support.ErrorPageFilter.access$000(ErrorPageFilter.java:61)
	at org.springframework.boot.web.support.ErrorPageFilter$1.doFilterInternal(ErrorPageFilter.java:92)
	at org.springframework.boot.web.support.ErrorPageFilter.doFilter(ErrorPageFilter.java:110)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
	at java.lang.Thread.run(Thread.java:748)
Caused by: java.net.URISyntaxException: Illegal character in query at index 129: https://biocache-beta.ala.org.au/occurrences/search?q=*%3A*&fq=species_group%3A%22Plants%22&wkt=MULTIPOLYGON(((117.93686628298018 -35.08208259312442,117.93208122209762 -35.082161610592784,117.93187737421249 -35.085287129061264,117.93249964670395 -35.08544515771328,117.93320774988388 -35.08535736405552,117.9336261744902 -35.08543637835176,117.93419480280134 -35.08562952408703,117.93494582132553 -35.08551539257147,117.9353749747679 -35.08515543828403,117.93571829752182 -35.084532099053554,117.93643712953781 -35.085322246565944,117.9380035396025 -35.08491839434922,117.93686628298018 -35.08208259312442)))
	at java.net.URI$Parser.fail(URI.java:2848)
	at java.net.URI$Parser.checkChars(URI.java:3021)
	at java.net.URI$Parser.parseHierarchical(URI.java:3111)
	at java.net.URI$Parser.parse(URI.java:3053)
	at java.net.URI.<init>(URI.java:588)
	at au.org.ala.downloads.plugin.DownloadsTagLib$_closure10.doCall(DownloadsTagLib.groovy:190)
	at org.grails.gsp.GroovyPage.invokeTagLibClosure(GroovyPage.java:417)
	at org.grails.gsp.GroovyPage.invokeTag(GroovyPage.java:335)
	... 45 common frames omitted

The new page on doi.ala.org.au appears to be working for this issue also.