-
Type: Bug
-
Status: Resolved
-
Priority: Minor
-
Resolution: Fixed
-
Affects Version/s: 7.10, 8.3
-
Component/s: Web Common
-
Tags:
-
Backlog priority:600
-
Sprint:nxfit 8.4.8, nxfit 8.10.1, nxfit 8.10.2, nxfit 9.1.1
-
Story Points:3
- create a workspace with brackets in its name
- create a Node.JS client script:
var Nuxeo = require('nuxeo'); var nuxeo = new Nuxeo({ auth: { method: 'basic', username: 'Administrator', password: 'Administrator' } }); nuxeo.repository().fetch('/default-domain/workspaces/[trucspace]');
This will generate the following stack trace:
2016-09-20 12:25:22,174 ERROR [http-bio-0.0.0.0-8080-exec-36] [nuxeo-error-log] java.lang.IllegalArgumentException: Illegal characters in: /v1/repo/default/path/default-domain/workspaces/[trucspace] at org.nuxeo.common.utils.URIUtils.quoteURIPathComponent(URIUtils.java:193) at org.nuxeo.common.utils.URIUtils.quoteURIPathComponent(URIUtils.java:163) at org.nuxeo.ecm.restapi.server.APIServlet.service(APIServlet.java:45) at javax.servlet.http.HttpServlet.service(HttpServlet.java:731)
Checking URIUtils.quoteURIPathComponent:
try { // fake scheme so that a colon is not mistaken as a scheme uri = new URI("x", s, null); } catch (URISyntaxException e) { throw new IllegalArgumentException("Illegal characters in: " + s, e); }
This is the expected behavior of URI according to RFC3986.
This prevents access via REST to Documents containing brackets.
Perhaps URL encoding only the brackets right before the URI object creation would allow this to work?
But at the client end using the following:
nuxeo.repository().fetch('/default-domain/workspaces/%5Btrucspace%5D');
does not work because it is already decoded when arriving in URIUtils.quoteURIPathComponent.