Invalid search result path encoding for nodes with spaces in node names
-----------------------------------------------------------------------
Key: JCR-2997
URL: https://issues.apache.org/jira/browse/JCR-2997
Project: Jackrabbit Content Repository
Issue Type: Bug
Components: jackrabbit-spi2dav
Affects Versions: 2.2.7
Reporter: David Buchmann
Priority: Minor
when using the davex remoting protocol, search for nodes with "_x0020 " in the
name fails.
Credentials sc = new SimpleCredentials("admin","admin".toCharArray());
Session s = repository.login(sc,workspace);
Node n = s.getRootNode();
n.addNode("Test _x0020 fail", "nt:unstructured");
System.out.println(n.hasNode("Test _x0020_ fail"));
s.save();
s = repository.login(sc,workspace);
n = s.getRootNode();
System.out.println(n.hasNode("Test _x0020 fail")); // => true
NodeIterator ni = n.getNodes("Test _x0020 fail");
System.out.println(ni.getSize()); // value > 0, increasing for each run
QueryManager qm = s.getWorkspace().getQueryManager();
Query query = qm.createQuery("SELECT * FROM [nt:unstructured]", Query.JCR_SQL2);
QueryResult result = query.execute();
NodeIterator iter = result.getNodes();
while ( iter.hasNext() ) {
Node row = iter.nextNode();
System.out.println(row.getPath()); // the node is not in the result set.
}
looking at the traffic that goes over the wire, i see that the _ is not
properly escaped while sending data over the network (but spaces are encoded
with the convention for export document view. other non-xml characters are
urlencoded, which makes more sense)
<dcr:column>
<dcr:name>jcr:path</dcr:name>
<dcr:value dcr:type="Path">/Test_x0020__x0020_x0020_fail</dcr:value>
<dcr:selectorName>nt:unstructured</dcr:selectorName>
</dcr:column>
this results in a request for the following url, which is of course not found.
(there is no way to find out whether the above path means "_x0020 " or "
_x0020_")
GET
/server/tests/jcr%3aroot/tests_general_base/index.txt/jcr%3acontent/Test%20escaping%20x0020_bla%20%3c%3e'%22%20node.0.json
probably the search result should encode spaces as %20?
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira