Details
-
Bug
-
Resolution: Invalid
-
Major
-
None
-
14.4.1
-
None
-
Debian XWiki 14.4.1, tomcat9
-
Unknown
-
Description
I am using Debian XWiki 14.4.1 with Tomcat9.
A file was uploaded as an attachment with square brackets in the name. Its name was of the form [characters].txt
I found that I could not open or delete the attachment. I was able to go into the page's attachments menu and rename it to remove the square brackets, after which, the attachment was usable again.
When attempting to open or delete the attachment, Tomcat will give an HTTP 400 response. I set relaxedPathChars="[]". This allowed XWiki to receive the request, however, XWiki cannot handle the filename either. When attempting to open the attachment, the following stack trace is produced:
javax.servlet.ServletException: Invalid URL [http://xwiki.domain.ca/wiki/wikiname/download/Main/WebHome/[testfile].txt?rev=1.1]javax.servlet.ServletException: Invalid URL [http://xwiki.domain.ca/wiki/wikiname/download/Main/WebHome/[testfile].txt?rev=1.1] org.xwiki.resource.servlet.RoutingFilter.constructExtendedURL(RoutingFilter.java:188) org.xwiki.resource.servlet.RoutingFilter.doFilter(RoutingFilter.java:95) org.xwiki.resource.CreateResourceReferenceException: Invalid URL [http://xwiki.domain.ca/wiki/wikiname/download/Main/WebHome/[testfile].txt?rev=1.1] org.xwiki.url.ExtendedURL.<init>(ExtendedURL.java:123) org.xwiki.resource.servlet.RoutingFilter.constructExtendedURL(RoutingFilter.java:186) org.xwiki.resource.servlet.RoutingFilter.doFilter(RoutingFilter.java:95) java.net.URISyntaxException: Illegal character in path at index 68: http://xwiki.domain.ca/wiki/wikiname/download/Main/WebHome/[testfile].txt?rev=1.1 java.base/java.net.URI$Parser.fail(URI.java:2913) java.base/java.net.URI$Parser.checkChars(URI.java:3084) java.base/java.net.URI$Parser.parseHierarchical(URI.java:3166) java.base/java.net.URI$Parser.parse(URI.java:3114) java.base/java.net.URI.<init>(URI.java:600) java.base/java.net.URL.toURI(URL.java:1061) org.xwiki.url.ExtendedURL.<init>(ExtendedURL.java:121) org.xwiki.resource.servlet.RoutingFilter.constructExtendedURL(RoutingFilter.java:186) org.xwiki.resource.servlet.RoutingFilter.doFilter(RoutingFilter.java:95)
The following is the request from clicking on the attachment:
10.22.96.4 - - [04/Aug/2022:10:23:39 -0400] "GET /wiki/wikiname/download/Main/WebHome/[testfile].txt?rev=1.1 HTTP/1.1" 500 2538